SecurityException when launching Intent
When user clicks on my status bar notification, an Activity Intent should be launched. However, nothing happens and this shows up in LogCat:
W/ActivityManager( 85): java.lang.SecurityException: Permission Denial: starting Intent { flg=0x20000000 cmp=cz.fhejl.pubtran.london/cz.fhejl.pubtran.PubtranMapActivity bn开发者_运维百科ds=[0,152][480,248] (has extras) } from null (pid=-1, uid=10049) requires null
The app package is cz.fhejl.pubtran.london but the Activity is in cz.fhejl.pubtran. Is this the problem? My application is based a library project, that's why the package names of the app and the Activity are differet.
Using
Intent notificationIntent = new Intent(getApplicationContext(), PubtranMapActivity.class);
instead of
Intent notificationIntent = new Intent(this, PubtranMapActivity.class); // "this" is instance of Service
solved the problem. Weird.
精彩评论