question

pawatl avatar image
pawatl asked

Push notification - token doesn't return.

I follow this tutorials.
link : https://api.playfab.com/docs/tutorials/landing-players/push-notification-basics/push-notifications-for-android

Token is not return without any error.

I try to split project for test only firebase push noti it work!!

this is AndroidManifest.xml of project doesn't work.

<?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="${applicationId}" android:versionCode="1" android:versionName="1.0">
  <application android:label="@string/app_name" android:icon="@drawable/app_icon">
    <!-- The MessagingUnityPlayerActivity is a class that extends
         UnityPlayerActivity to work around a known issue when receiving
         notification data payloads in the background. -->
    <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
    <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb1644962085748616" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider1644962085748616" android:exported="true" />
  </application>
</manifest>

and this AndroidManifest.xml of split project.

<?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="${applicationId}" android:versionCode="1" android:versionName="1.0">
  <application android:label="@string/app_name" android:icon="@drawable/app_icon">
    <!-- The MessagingUnityPlayerActivity is a class that extends
         UnityPlayerActivity to work around a known issue when receiving
         notification data payloads in the background. -->
    <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
    <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb1644962085748616" />
    <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="true" />
    <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled" android:value="true" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider1644962085748616" android:exported="true" />
  </application>
</manifest>

In project has facebook, playfab, google signIn, firebase push noti.

Thank for help.

Push Notifications
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

It is hard to tell where the issue is because the only differences between these 2 AndroidManifest.xml files are line 24 and line 25:

    <meta-dataandroid:name="com.facebook.sdk.AutoLogAppEventsEnabled"android:value="true"/>
    
    <meta-dataandroid:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"android:value="true"/>

    which is from Facebook SDK.

    Do you mind sharing some development processes and detailed descriptions about your issue?

    0 Likes 0 ·
    pawatl avatar image pawatl Seth Du ♦ commented ·

    Sry now I think AndroidManifest is not a problem because I try to upgrade facebook sdk to same version and now AndroidManifest in two project it alike.

    In a problem project I use facebook sdk, playfab, google signIn, google play-service and Photon when I try to import FirebaseMessaging.unitypackage into project and follow a this tutorial https://api.playfab.com/docs/tutorials/landing-players/push-notification-basics/push-notifications-for-android build and test run on android device but callback firebaseMessaging.TokenReceived is not work.

    But when I try to create new project and follow the tutorial again it work. without playfab, google signIn, google play-service and photon. above Androidmanifest is after import facebook sdk.

    In two project it a same firebase project, same keystore, same project Id.

    0 Likes 0 ·
    Seth Du avatar image Seth Du ♦ pawatl commented ·

    The Documentation you read seems not very detailed about Firebase configuration. Have you configured your App like this article (Firebase part) illustrates: https://api.playfab.com/docs/tutorials/landing-players/push-notification-basics/java-push. You also need to import the google-services.json file into your project.

    If you are looking for implementing FireBase on Unity, you can check this article and read through the above article as supplementary.

    0 Likes 0 ·

    1 Answer

    ·
    pawatl avatar image
    pawatl answered

    Ok now I can fix this issue.

    It becouse PlayFabUnityAndroid.aar and PlayFabAdInfo.arr in plugin folder.(Delete it!!)

    This issue happen becouse playfab older version in my project.

    Hope this can help someone..

    10 |1200

    Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

    Write an Answer

    Hint: Notify or tag a user in this post by typing @username.

    Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.