Attempt to tie subprocess lifetime to the android activity.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4320 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
ca28b5ca82
commit
0e8867dd6e
2
Makefile
2
Makefile
@ -494,7 +494,7 @@ out/%.apk: out/apk/%.unsigned.apk
|
|||||||
apk: out/TildeFriends-debug.apk
|
apk: out/TildeFriends-debug.apk
|
||||||
.PHONY: apk
|
.PHONY: apk
|
||||||
|
|
||||||
apkgo: out/TildeFriends-debug.apk
|
apkgo: out/TildeFriends-release.apk
|
||||||
@adb install $<
|
@adb install $<
|
||||||
@adb shell am start com.unprompted.tildefriends/.MainActivity
|
@adb shell am start com.unprompted.tildefriends/.MainActivity
|
||||||
.PHONY: apkgo
|
.PHONY: apkgo
|
||||||
|
@ -38,6 +38,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
WebView web_view;
|
WebView web_view;
|
||||||
String base_url;
|
String base_url;
|
||||||
|
Process process;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -122,15 +123,11 @@ public class MainActivity extends Activity {
|
|||||||
builder.directory(getFilesDir());
|
builder.directory(getFilesDir());
|
||||||
builder.inheritIO();
|
builder.inheritIO();
|
||||||
try {
|
try {
|
||||||
builder.start();
|
process = builder.start();
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
Log.w("tildefriends", "IOException starting process: " + e.toString());
|
Log.w("tildefriends", "IOException starting process: " + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (java.lang.InterruptedException e) {
|
|
||||||
}
|
|
||||||
web_view.getSettings().setJavaScriptEnabled(true);
|
web_view.getSettings().setJavaScriptEnabled(true);
|
||||||
web_view.getSettings().setDatabaseEnabled(true);
|
web_view.getSettings().setDatabaseEnabled(true);
|
||||||
web_view.getSettings().setDomStorageEnabled(true);
|
web_view.getSettings().setDomStorageEnabled(true);
|
||||||
@ -188,6 +185,18 @@ public class MainActivity extends Activity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy()
|
||||||
|
{
|
||||||
|
if (process != null) {
|
||||||
|
Log.w("tildefriends", "Killing process.");
|
||||||
|
process.destroyForcibly();
|
||||||
|
Log.w("tildefriends", "Process killed.");
|
||||||
|
process = null;
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState)
|
protected void onSaveInstanceState(Bundle outState)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user