mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-16 03:38:55 +00:00
android: show sync progress at notification, prevent app to sleep, temp fix of hanging after closing from recent apps
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package mw.gri.android;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import com.google.androidgamesdk.GameActivity;
|
||||
@@ -9,7 +9,7 @@ import com.google.androidgamesdk.GameActivity;
|
||||
public class MainActivity extends GameActivity {
|
||||
|
||||
static {
|
||||
System.loadLibrary("grim_android");
|
||||
System.loadLibrary("grim");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -20,9 +20,29 @@ public class MainActivity extends GameActivity {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
BackgroundService.start(getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (!mManualExit) {
|
||||
BackgroundService.stop(getApplicationContext());
|
||||
// Temporary fix to prevent app hanging when closed from recent apps
|
||||
Process.killProcess(Process.myPid());
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public int[] getDisplayCutouts() {
|
||||
return Utils.getDisplayCutouts(this);
|
||||
}
|
||||
|
||||
private boolean mManualExit = false;
|
||||
|
||||
// Called from native code
|
||||
public void onExit() {
|
||||
mManualExit = true;
|
||||
BackgroundService.stop(getApplicationContext());
|
||||
finish();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user