I re-install my .apk programmatically by code while it is running and when re-install finishes Open button does not launch the 开发者_C百科app.It just closes Open Finish window.Then I have to go to menu and launch it clicking there.
Does anyone know anything about this issue?
I guess this would be because the application signature changes or sth like that?
Your activity name may have changed, and now home screen shortcut probably points to non-existing activity. Delete the old home-screen shortcut, and place there new one.
Make sure you have code below for your main activity in your Manifest:
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
Also make sure to close your app when you are reinstalling. You can use this:
android.os.Process.killProcess(android.os.Process.myPid());
or
System.exit(0);
Finally Add the code below to your onCreate() in your Main Activity :
if (!isTaskRoot()) {
finish(); return; }
Hope it works :)
精彩评论