0

I came across with the following issue. I have an activity that uses to permissions: recording audio and writing to external storage and returns the result to those activities that started it with an intent. I want to make sure that only those other apps could launch it, that have both uses-permissions. I tried the following declaration in manifest file, but it seems to be incorrect, as android does not allow double use of android permission attribute in activity.

<activity
    android:name="some_name"
    android:label="some_label"
    android:permission="android.permission.RECORD_AUDIO"
    android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
</activity>

Is there any way to make this possible with android?

Eduard3192993
  • 216
  • 3
  • 12
  • 1
    Note that if your `` really looks as it does in your code snippet, no other apps can launch it. You have no ``, and so this activity is not exported. Beyond that, while I have not tried it, you may be able to call `checkCallingPermission()` on your activity in `onCreate()` to see if the caller holds the second permission, whichever one you are not enforcing via `android:permission`. – CommonsWare Aug 09 '15 at 14:58

1 Answers1

0

You can crate a custom permission which can be android.permission.RECORD_AUDIO and android.permission.WRITE_EXTERNAL_STORAGE (Both in one permission) and then put that permission in your Activiy.

Community
  • 1
  • 1
arodriguezdonaire
  • 5,396
  • 1
  • 26
  • 50