[积累] 解决Exported receiver does not require permission问题

来源:互联网 发布:淘宝刷好评兼职犯法吗 编辑:程序博客网 时间:2024/05/03 04:23

其实是需要给Receiver 添加权限

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.testiphonenotification"    android:versionCode="1"    android:versionName="1.0" >    <permission        android:name="com.example.testiphonenotification.SEND_IPHONE_NOTIFICATION"        android:protectionLevel="normal" />    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />    <uses-permission android:name="com.example.testiphonenotification.SEND_IPHONE_NOTIFICATION" /> <!-- 需要这个权限才能发松通知 -->    <uses-sdk        android:minSdkVersion="14"        android:targetSdkVersion="21" />    <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@style/AppTheme" >        <activity            android:name=".MainActivity"            android:label="@string/app_name" >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <service android:name=".IPhoneNotificationService" >        </service>        <receiver            android:name=".IPhoneNotificationReceiver"            android:permission="com.example.testiphonenotification.SEND_IPHONE_NOTIFICATION" > //定义权限            <intent-filter>                <action android:name="com.example.testiphonenotification" />            </intent-filter>        </receiver>    </application></manifest>
0 0
原创粉丝点击