문제

I have an application that starts the app selected by a user when it is clicked (like a launcher would). Note however that the actual starting of the app is performed by a service because of abstraction.

One note by a user: Launching greader from your app opens greader as if it had never been used, prompting for account details etc regardless of whether they have been entered previously. Launching greader from any other method (nova laucher app drawer) gets me to my usual newsfeed.

Other users are reporting issues with root explorer crashing when started.

My best bet is that is has something to do with the launch flags. After investigating the default android launcher, my conclusion is that I am using the same flags.

These flags are: Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED

What flags should I be using instead? I would not prefer to add exceptions for certain apps, so the flags should work for all apps to be started.

Thanks for any help

도움이 되었습니까?

해결책

The problem was not with the flags themselves, they were just fine. This issue was with the action not being set properly. The problem was solved by initializing the intent like this:

Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_DEFAULT);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top