0

Getting this strange exception in my crashlytics reports.

Fatal Exception: java.lang.SecurityException
Permission Denial: starting Intent { act=android.intent.action.PICK_ACTIVITY cmp=com.android.settings/.ActivityPicker (has extras) } from ProcessRecord{41bc95c0 6397:com.sampleapp.sample/u0a10087} (pid=6397, uid=10087) requires android.permission.SECURITY_ACTIVITY

The affected functionality is

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Text to share");
Intent intentPick = new Intent();
intentPick.setAction(Intent.ACTION_PICK_ACTIVITY);
intentPick.putExtra(Intent.EXTRA_TITLE, "Share link");
intentPick.putExtra(Intent.EXTRA_INTENT, sendIntent);
this.startActivityForResult(intentPick, REQUEST_CODE_MY_PICK);

And it seems to only affect specific Huawei Devices running And 4.2.2 and 4.4.2.

Sachin Rajput
  • 4,326
  • 2
  • 18
  • 29
kev
  • 1,148
  • 2
  • 14
  • 29
  • In your `AndroidManifest.xml` add in your activity `android:exported="true"` – sharp Jan 25 '18 at 13:01
  • In which Activity? The one that does the startActivityForResult()? – kev Jan 25 '18 at 13:04
  • I belive in the one who is in `` tags... – sharp Jan 25 '18 at 13:06
  • `requires android.permission.SECURITY_ACTIVITY` is in your exception stacktrace. Did you see it? – Vladyslav Matviienko Jan 25 '18 at 13:17
  • 2
    There is no `SECURITY_ACTIVITY` permission in the Android SDK. This must be something Huawei added, inexplicably. You can try adding a `` element for that permission to your manifest, in hopes that perhaps this is a permission that ordinary apps can request. Otherwise... avoid `ACTION_PICK_ACTIVITY`, at least on Huawei devices. – CommonsWare Jan 25 '18 at 13:25

0 Answers0