开发者

Permissions with PendingIntent.getBroadcast() and AlarmManager

开发者 https://www.devze.com 2023-04-13 01:49 出处:网络
Is there a way to enforce receiver permissions for intents broadcast by the AlarmManager? For example, I want to do this:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号