Android 4.2 Notification to start activity failure via pendingintent

Source: Internet
Author: User

Today suddenly found on Android 4.2 mobile phone Click on the notification message can not open the activity of the problem, the specific logcat information as follows:

 01-09 11:37:43.733:warn/activitymanager: Unable to send startactivity intentjava.lang.SecurityException: Permission denial:starting Intent {flg=0x10800000cmp=org.goodev/.activities. PROJECTACTIVITYBNDS=[254,64][466,140]} from  Null (Pid=-1, uid=10073)  requires nullatcom.android.server.am.ActivityStack.startActivityLocked (activitystack.java:1973) Atcom.android.server.am.ActivityManagerService.startActivityInPackage (activitymanagerservice.java:2271) Atcom.android.server.am.PendingIntentRecord.sendInner (pendingintentrecord.java:212) Atcom.android.server.am.ActivityManagerService.startActivityIntentSender (activitymanagerservice.java:2134) Atandroid.app.ActivityManagerNative.onTransact (activitymanagernative.java:211) Atcom.android.server.am.ActivityManagerService.onTransact (activitymanagerservice.java:1467) at Android.os.Binder.execTransact (binder.java:320) at Dalvik.system.NativeStart.run (Native Method)  

Notable places are marked in red.

The study found that the problem should be caused by 4.2 safety-enhancing controls. It is easier to solve this problem by adding a "android:exported=" true "property" to the activity declaration in the Androidmanifest.xml file.

This means that no exported activity can be initiated externally from the 4.2 system. Starting the activity through Pendingintent, starting the source for the system, and the application being launched is not a PID.

The explanation for the exported property is as follows:

android:exported Whether or not the activity can is launched by components of and applications-" tru E "If it can be, and" false "if not. If " false ", the activity can be launched only by the components of the same application or applications with the Same user ID.

the default value depends on whether the activity contains intent filters. The absence of any filters means that the activity can is invoked only by specifying its exact class name. This implies, the activity is intended only for application-internal use (since others would not know the class name). The ' so ' case and the default value is ' false '. On the other hand, the presence of in least one filter implies that activity are intended for external use, so the DEFA Ult value is " true ".

This attribute isn't the only-to-limit an activity's exposure to other applications. You can also use a permission to limit the external entities that can invoke the activity (see the permission attribute).

More Information reference: http://developer.android.com/guide/topics/manifest/activity-element.html#exported

Android 4.2 Notification to start activity failure via pendingintent

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.