BroadcastReceiver requires android.permission.RECEIVE_BOOT_COMPLETED -
my android app needs notified boot_completed
event. androidmanifest.xml contains <uses-permission android:name="android.permission.receive_boot_completed" />
, inside <application>
tag have following receiver definition:
<receiver android:name=".onbootreceiver" android:permission="android.permission.receive_boot_completed"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver>
is android:permission="android.permission.receive_boot_completed"
required? happens if not in place, there risk of application being able simulate boot event , invoking app?
in examples, the receiver contains receive_boot_completed permission , some receiver not. there api level specific differences?
is android:permission="android.permission.receive_boot_completed" required?
no, don't require permission
attribute inside <receiver>
declaration particular case. docs:
android:permission
the name of permission broadcasters must have send message broadcast receiver. if attribute not set, permission set
<application>
element'spermission
attribute applies broadcast receiver. if neither attribute set, receiver not protected permission.
so need attribute if want make sure broadcasters authorized permission can send it. however, boot_completed
protected intent can sent system anyway. wouldn't hurt have there not necessary.
edit:
it probably wouldn't hurt leave permission
attribute there many android versions , device changes out there, not include attribute sure. don't include in apps.
Comments
Post a Comment