Search code examples
androidandroid-intentadb

broadcast secret code with permission


I want to be able to broadcast this intent

<receiver android:name="GsdBroadcastReceiver" android:permission="com.htc.permission.APP_DEFAULT">
   <intent-filter>
       <action android:name="android.provider.Telephony.SECRET_CODE" />
           <data android:scheme="android_secret_code" android:host="3424" />
       </intent-filter>
</receiver>

so far this is how i'm trying to launch it

adb shell am broadcast -W -a android.provider.Telephony.SECRET_CODE -d android_secret_code://3424

but I haven't succeed with that, I think the problem comes with the permission, do you know how I can deal with it?


Solution

  • I have not tried that in Java, but it works fine via adb. However, you have to run it with superuser.

    adb shell "su -c 'am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://0011'"
    

    Tested on rooted Samsung Galaxy S4 with Android 4.3. I used 0011 secret code (3424 is for HTC devices).