My app sends out a notification, which opens the Browser with the given url on tapping. Actually, the wrapped intent is sent to a BroadcastReceiver, and this broadcast receiver starts Browser.
Intent browserIntent = new Intent(Intent.ACTION_VIEW, intent.getData());
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(showTaskIntent);
It works fine with the notification on pull-down notification bar, but not with the lock screen notification. It's not able to open Browser on double tapping.
From the log, I can see ActivityManager receives the intent, and tries to start Broswer:
09-02 15:10:52.309 1536-1894/system_process I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://www.thesun.co.uk/... flg=0x10000000 cmp=com.android.browser/.BrowserActivity} from uid 10059 on display 0
But what happened to Browser is
09-02 15:10:52.910 12131-12131/com.android.browser I/art: Starting a blocking GC Explicit 09-02 15:10:52.978 12131-12131/com.android.browser I/art: Explicit concurrent mark sweep GC freed 44(1768B) AllocSpace objects, 0(0B) LOS objects, 15% free, 11MB/13MB, paused 427us total 63.223ms 09-02 15:10:52.980 12131-12131/com.android.browser I/art: Starting a blocking GC Explicit 09-02 15:10:53.095 12131-12131/com.android.browser I/art: Explicit concurrent mark sweep GC freed 5(160B) AllocSpace objects, 0(0B) LOS objects, 15% free, 11MB/13MB, paused 697us total 114.607ms 09-02 15:10:53.095 12131-12131/com.android.browser I/art: Starting a blocking GC Explicit 09-02 15:10:53.255 12131-12131/com.android.browser I/art: Explicit concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 15% free, 11MB/13MB, paused 42.926ms total 145.640ms
My assumption is: at that time, the device is still locked by lock screen, when ActivityManager delivers the intent to start Browser, the Android system might have some checks or mechanism not to start that activity.
Has anyone had such a problem before? Thanks!