首页 > 解决方案 > Xamarin.Android 异常与 FCM & Parse

问题描述

我能够实现 Firebase 通知并成功地从 Firebase 控制台向客户端发送通知。当我使用 Parse SDK 通过 Parse Dashboard 发送通知时,就会出现问题。我正在使用 Xamarin.Android,而带有 FCM 和 Parse 的 Native Android 的文档并不完整。我注意到通过 Parse Dashboard 发送通知时,客户端出现以下异常:

Java.Lang.RuntimeException: Unable to instantiate service com.parse.fcm.ParseFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class 

当解析文档告诉我在下面实现以下清单时:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.xamarin.fcmexample" android:installLocation="preferExternal">
    <uses-sdk android:minSdkVersion="20" android:targetSdkVersion="25" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="g" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
        <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="${applicationId}" />
            </intent-filter>
        </receiver>
        <service android:name="com.parse.fcm.ParseFirebaseInstanceIdService" android:exported="true">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
        <service android:name="com.parse.fcm.ParseFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
            <intent-filter>
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>
    </application>
</manifest>

想知道我是否缺少任何东西来让 Xamarin.Android + Parse SDK + FCM 工作。谢谢。

标签: parse-platformxamarin.androidfirebase-cloud-messaging

解决方案


推荐阅读