broadcastreceiver - confusion in using android:permission for android.permission.RECEIVE_BOOT_COMPLETED -
please have @ following maniferst.xml file
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pack.saltriver" android:versioncode="1" android:versionname="1.0" android:permission="android.permission.receive_boot_completed"> <uses-permission android:name="android.permission.receive_boot_completed"></uses-permission> <application android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name=".autostart"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <activity android:name=".hello"></activity> <service android:enabled="true" android:name=".service" /> </application> </manifest>
do need use both
android:permission="android.permission.receive_boot_completed">
and
<uses-permission android:name="android.permission.receive_boot_completed"></uses-permission>
and what's differences between them?
no, change manifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pack.saltriver" android:versioncode="1" android:versionname="1.0"> <uses-permission android:name="android.permission.receive_boot_completed"></uses-permission> <application android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name=".autostart"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <activity android:name=".hello"></activity> <service android:enabled="true" android:name=".service" /> </application> </manifest>
here answer why have to.. documentation
declares security permission can used limit access specific components or features of or other applications.
therefore, since accessing android's permissions, want uses-permission instead. documentation element states:
requests permission application must granted in order operate correctly.
used when making custom permission (e.g. when making app other apps can tie in to, limiting access must), , used when app needs permission doesn't have normally.
Comments
Post a Comment