finish the app on update otherwise the app plus its intent gets killed
This commit is contained in:
parent
01bfbdb3fd
commit
f20211e5dd
@ -43,7 +43,6 @@ import java.util.Stack;
|
|||||||
public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeListener, LocationListener {
|
public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeListener, LocationListener {
|
||||||
|
|
||||||
private static final int REQUEST_LOGIN = 1;
|
private static final int REQUEST_LOGIN = 1;
|
||||||
public static final int REQUEST_UPDATE_FINISHED = 2;
|
|
||||||
|
|
||||||
private IITC_WebView mIitcWebView;
|
private IITC_WebView mIitcWebView;
|
||||||
private final String mIntelUrl = "https://www.ingress.com/intel";
|
private final String mIntelUrl = "https://www.ingress.com/intel";
|
||||||
@ -588,9 +587,6 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
// authentication activity has returned. mLogin will continue authentication
|
// authentication activity has returned. mLogin will continue authentication
|
||||||
mLogin.onActivityResult(resultCode, data);
|
mLogin.onActivityResult(resultCode, data);
|
||||||
break;
|
break;
|
||||||
case REQUEST_UPDATE_FINISHED:
|
|
||||||
// clean up update apk
|
|
||||||
deleteUpdateFile();
|
|
||||||
default:
|
default:
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
@ -658,7 +654,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
request.allowScanningByMediaScanner();
|
request.allowScanningByMediaScanner();
|
||||||
Uri fileUri = Uri.parse("file://" + getExternalFilesDir(null).toString() + "/iitcUpdate.apk");
|
Uri fileUri = Uri.parse("file://" + getExternalFilesDir(null).toString() + "/iitcUpdate.apk");
|
||||||
request.setDestinationUri(fileUri);
|
request.setDestinationUri(fileUri);
|
||||||
// remove old files (iitcm cleans up after installation, but you never know...)
|
// remove old update file...we don't want to spam the external storage
|
||||||
deleteUpdateFile();
|
deleteUpdateFile();
|
||||||
// get download service and enqueue file
|
// get download service and enqueue file
|
||||||
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
|
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
|
||||||
@ -669,7 +665,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
String iitcUpdatePath = getExternalFilesDir(null).toString() + "/iitcUpdate.apk";
|
String iitcUpdatePath = getExternalFilesDir(null).toString() + "/iitcUpdate.apk";
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(Uri.fromFile(new File(iitcUpdatePath)), "application/vnd.android.package-archive");
|
intent.setDataAndType(Uri.fromFile(new File(iitcUpdatePath)), "application/vnd.android.package-archive");
|
||||||
startActivityForResult(intent, REQUEST_UPDATE_FINISHED);
|
startActivity(intent);
|
||||||
|
// finish app, because otherwise it gets killed on update
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user