0

我们已将 Unity 与 Clevertap 和 Firebase 集成在一起,我们可以看到用户在clevertap 仪表板上被跟踪,并发送推送通知并从 Clevertap 仪表板开始活动。在 Clevertap 集成之前(我们只有 Firebase 集成),我们有一个功能,用于获取正常的 FCM PN。行为是这样的,如果应用程序在后台或被杀死,我们曾经在通知托盘上获取推送通知。如果应用程序在前台,我们通常会获取OnMessageReceivedFirebase 集成所需的回调:

  Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;
  Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;
}
public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) {
  UnityEngine.Debug.Log("Received Registration Token: " + token.Token);
}
public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) {
  UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
}```    
Now after clevertap integration if the app is in background or killed, we do get the Push notif on notification tray,
triggered from both ends FCM and clevertap dashboard
Now after clevertap integration if the app is in foreground, we are getting notifications on notification tray when triggered by Clevertap dashboard only.
Problem is, if we trigger through the normal FCM we are not getting a call back.
AndroidManifest File is:
```<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="xxxxxxxx" android:installLocation="auto" android:versionCode="10026" android:versionName="xxx">
  <!-- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="28"/> -->
  <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
  <!-- <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" /> -->
  <application android:name="androidx.multidex.MultiDexApplication" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:usesCleartextTraffic="false">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <intent-filter>
        <data android:scheme="xxxxx" android:host="open" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
      </intent-filter>
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https"
              android:host="xxxxx"
              android:pathPrefix="/Fwcy" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notify_icon_small" />
    <receiver android:name="xxxxx.AndroidBackgroundThread"></receiver>
    <receiver android:name="xxxxx.LocalNotificationActionHandler"></receiver>
    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
    <!-- Start of MF clevertap -->
    <service
        android:name="com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <service
        android:name="com.clevertap.android.sdk.pushnotification.CTNotificationIntentService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.clevertap.PUSH_EVENT" />
        </intent-filter>
    </service>
    <meta-data 
        android:name="CLEVERTAP_APP_PACKAGE" 
        android:value="xxxxxxxxx" />
    <meta-data
        android:name="FCM_SENDER_ID"
        android:value="id:xxxxxxxxxx" />
    <meta-data
        android:name="CLEVERTAP_ACCOUNT_ID"
        android:value="xxxxxx" />
    <meta-data
        android:name="CLEVERTAP_TOKEN"
        android:value="xxxxxx" />
    <!-- End of MF clevertap -->
  </application>
</manifest>```
4

0 回答 0