1

我已经使用所有提供的推送通知详细信息配置了 connetycube sdk。而且我使用了手动订阅策略。

FCM 推送通知服务

class AppFireBaseMessagingService : FcmPushListenerService() {

    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        super.onMessageReceived(remoteMessage)

        NotificationUtils.getInstance(applicationContext).processPushNotification(remoteMessage.data)
    }

    override fun onNewToken(token: String) {
        super.onNewToken(token)
        Log.d("FCM Token", token)
    }
}

ConnectyCube 设置配置

  ConnectycubeSettings.getInstance()
            .init(
                applicationContext,
                BuildConfig.voIPAppId,
                BuildConfig.voIPAuthKey,
                BuildConfig.voIPAuthSecrect
            )
        ConnectycubeSettings.getInstance().accountKey = BuildConfig.voIPAccountKey
        ConnectycubeSettings.getInstance().isEnablePushNotification = true
        ConnectycubeSettings.getInstance().subscribePushStrategy = SubscribePushStrategy.MANUAL

清单配置

        <service
                android:name=".common.services.fcm.AppFireBaseMessagingService"
                android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>

        </service>
        <meta-data android:name="com.connectycube.pushnotifications.TYPE" android:value="FCM" />
        <meta-data android:name="com.connectycube.pushnotifications.SENDER_ID" android:value="@string/fcm_sender_id" />
        <meta-data android:name="com.connectycube.pushnotifications.ENVIRONMENT" android:value="DEVELOPMENT" />

当我在用户登录后尝试订阅时。

 SubscribeService.subscribeToPushes(context, false)

发生错误。我列出了错误响应:

Push Subscription error: base Forbidden. Need user. code: -1
    com.connectycube.core.exception.ResponseException: base Forbidden. Need user.
        at com.connectycube.core.parser.JsonParser.parse(Unknown Source:49)
        at com.connectycube.auth.session.Query.perform(Unknown Source:59)
        at com.connectycube.pushnotifications.services.SubscribeService.a(Unknown Source:27)
        at com.connectycube.pushnotifications.services.SubscribeService.a(Unknown Source:125)
        at com.connectycube.pushnotifications.services.SubscribeService.e(Unknown Source:12)
        at com.connectycube.pushnotifications.services.SubscribeService.b(Unknown Source:18)
        at com.connectycube.pushnotifications.services.SubscribeService.onHandleWork(Unknown Source:47)
        at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)
        at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
4

0 回答 0