Is there a way to enforce receiver permissions for intents broadcast by the AlarmManager? For example, I want to do this:
AlarmManager am = (AlarmMana开发者_开发问答ger) getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent("myapp.MY_ACTION");
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
am.setRepeating(AlarmManager.RTC_WAKEUP, now, MY_INTERVAL, pendingIntent);
But make the broadcasts sent by the AlarmManager act like this:
sendBroadcast(intent, "myapp.permission.RECEIVE_BROADCASTS");
I do not believe that this is possible, sorry. There is no place to provide this permission on either Intent
or PendingIntent
.
精彩评论