我的整個想法是有點複雜,但只是爲了打破下來所以他們簡單,這裏的點...我有一個小部件的按鈕,我需要打開官方Facebook應用程序中的「地點」活動。的意圖外活動許可拒絕
下面是我使用的代碼:
Intent PlacesIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(new ComponentName("com.facebook.katana", "com.facebook.katana.activity.places.PlacesNearbyActivity"));
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, PlacesIntent, 0);
views.setOnClickPendingIntent(R.id.places, pendingIntent);
我得到這個錯誤在logcat中:
11-06 22:26:48.117: WARN/ActivityManager(85): Permission denied: checkComponentPermission() reqUid=10055
11-06 22:26:48.117: WARN/ActivityManager(85): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.facebook.katana/.activity.places.PlacesNearbyActivity bnds=[371,129][428,203] } from null (pid=-1, uid=10157) requires null
11-06 22:26:48.127: WARN/ActivityManager(85): Unable to send startActivity intent
11-06 22:26:48.127: WARN/ActivityManager(85): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.facebook.katana/.activity.places.PlacesNearbyActivity bnds=[371,129][428,203] } from null (pid=-1, uid=10157) requires null
11-06 22:26:48.127: WARN/ActivityManager(85): at com.android.server.am.ActivityManagerService.startActivityLocked(ActivityManagerService.java:3223)
11-06 22:26:48.127: WARN/ActivityManager(85): at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:3980)
11-06 22:26:48.127: WARN/ActivityManager(85): at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:212)
11-06 22:26:48.127: WARN/ActivityManager(85): at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:3843)
11-06 22:26:48.127: WARN/ActivityManager(85): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:210)
11-06 22:26:48.127: WARN/ActivityManager(85): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1480)
11-06 22:26:48.127: WARN/ActivityManager(85): at android.os.Binder.execTransact(Binder.java:288)
11-06 22:26:48.127: WARN/ActivityManager(85): at dalvik.system.NativeStart.run(Native Method)
如果我使用,
Intent PlacesIntent1 = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(new ComponentName("com.facebook.katana", "com.facebook.katana.HomeActivity"));
PendingIntent pendingIntent1 = PendingIntent.getActivity(context, 0, PlacesIntent1, 0);
views.setOnClickPendingIntent(R.id.facebook, pendingIntent1);
一切的偉大工程,它打開家裏的活動,但是這不是真的是我想要做的事。
我已經試過
com.facebook.katana.activity.places.PlacesNearbyActivity - I actually see a respons in the logcat about the denail with this one
com.facebook.katana.activity.PlacesNearbyActivity
com.facebook.katana.places.PlacesNearbyActivity
com.facebook.katana.PlacesNearbyActivity
,並沒有與其他
發生在這裏就是我在logcat中看到,當手動打開我的手機上的活動:
11-06 20:20:38.295: INFO/ActivityManager(85): Starting activity: Intent { cmp=com.facebook.katana/.activity.places.PlacesNearbyActivity }
11-06 22:03:28.027: INFO/ActivityManager(85): Starting activity: Intent { flg=0x4000000 cmp=com.facebook.katana/.HomeActivity }
所以, ,讓你排序的想法我得到了我的信息。