FCM通知:SecurityException:不允许启动服务Intent

时间:2017-04-12 18:49:39

标签: android firebase xamarin firebase-cloud-messaging

我试图让Xamarin.Android应用程序测试使用FCM进行不同类型的通信,并且我已经能够设置所有内容但是当我尝试获取注册令牌时对于我的Visual Studio模拟器 - Android(Marshmallow),我收到此错误..

  

java.lang.SecurityException:不允许启动服务Intent {   act = com.google.android.c2dm.intent.REGISTER pkg = com.google.android.gms   (有额外的)}未经许可   com.google.android.c2dm.permission.RECEIVE 04-12 11:43:44.679   E / FirebaseInstanceId(1793):

这是我的Android.manifest - obj \ debug

中的完整内容
   <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.fqtrs.xamtest" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
  <!--suppress UsesMinSdkAttributes-->
  <uses-sdk android:minSdkVersion="16" />
  <!-- This app has permission to register with GCM and receive message -->
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="com.google.android.c2dm.permission.SEND" />
  <uses-permission android:name="android.permission.INTERNET" />
  <!-- Required to wakeup the device and deliver messages -->
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <permission android:name="net.fqtrs.xamtest.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <uses-permission android:name="net.fqtrs.xamtest.permission.C2D_MESSAGE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <application android:label="FCMNotifications" android:name="android.app.Application" android:allowBackup="true" android:icon="@drawable/icon" android:debuggable="true">
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
        <category android:name="net.fqtrs.xamtest" />
      </intent-filter>
    </receiver>
    <activity android:icon="@drawable/icon" android:label="FCMNotifications" android:name="md50b8cb7a267d8690e7668352ad20476c5.MainActivity">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <service android:name="md50b8cb7a267d8690e7668352ad20476c5.MyFirebaseIIDService">
      <intent-filter>
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
      </intent-filter>
    </service>
    <service android:name="md50b8cb7a267d8690e7668352ad20476c5.MyFirebaseMessagingService">
      <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="net.fqtrs.xamtest.mono.MonoRuntimeProvider.__mono_init__" />
    <!--suppress ExportedReceiver-->
    <receiver android:name="mono.android.Seppuku">
      <intent-filter>
        <action android:name="mono.android.intent.action.SEPPUKU" />
        <category android:name="mono.android.intent.category.SEPPUKU.net.fqtrs.xamtest" />
      </intent-filter>
    </receiver>
    <provider android:authorities="net.fqtrs.xamtest.firebaseinitprovider" android:name="com.google.firebase.provider.FirebaseInitProvider" android:exported="false" android:initOrder="100" />
    <!-- FirebaseMessagingService performs security checks at runtime,
             no need for explicit permissions despite exported="true" -->
    <service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="true">
      <intent-filter android:priority="-500">
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <activity android:name="com.google.android.gms.common.api.GoogleApiActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="false" />
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
  </application>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

我无法弄清楚它有什么问题。有人有什么想法吗?

0 个答案:

没有答案