Android issue: This issue is coming only 1st time after installation and clicking on open button, after launching application with launcher icon then issue will never come.
- Steps to reproduce the problem.
- Install Any .apk file
- After installation you will get two buttons "Open" and "Done".
- Onclick of Open button it's opening/starting application.
- now Navigate in you application and go to any other screen, like on 2nd screen, 3rd screen.
- Now, Press Home and put application in background (means put in pause sate).
- Now go to list of application Click on Launcher Icon of same application.
- What happened.
- It is Launching Same application from start point at first screen.
- It must resume the running application on 3rd screen.
- Now press back and come out from 1st screen of 2nd time started application.
- It is showing 1st time run application's 3rd screen.
- What you think the correct behavior should be.
- Application must resume.
- application must not come in inconsistent state.
- Clicking on "Open" button logs :
"See no category added in intent above"
- Clicking on "Launcher" Icon’s logs :
"See category added in intent above".
If some one tell me how to Resolve this or tell how to add category as android.intent.category.LAUNCHER on "Open" button click then problem will resolve.
I have tried to add category in intent on app start, oncreate and many places. intent.addCategory("android.intent.category.LAUNCHER"); Also tried to work with IntentFilter, PackageManager.
This issue is in every Android phone.
RESOLVE
Add this code into oncreate() method
if (!isTaskRoot()) {More informations: http://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508#16447508
final Intent intent = getIntent();
final String intentAction = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER)
&& intentAction != null
&& intentAction.equals(Intent.ACTION_MAIN)) {
finish();
}
}
0 comments:
Post a Comment