question

fivefinger2015 avatar image
fivefinger2015 asked

Android Push notification _RegistrationCallback problem

Problem is the event PlayFabGoogleCloudMessaging._RegistrationReadyCallback never callback.

PlayFabGoogleCloudMessaging.GetToken () does not respond.

I was using the push function without any problems.

But I found that the push does not work today.

I upgraded my playfab sdk version last week.

So while looking at the push function, I noticed that the AndroidPushPlugin version is using the Unity 4 version. (my unity is 5)

So I installed version 5 and I have removed some overlapping Java library files.

(I'm using Ultimate mobile asset. (stan's asset))

I was removed play-services-*.* files.

The modified manifest file is as follows.

<?xml version="1.0" encoding="UTF-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="--" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0"> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" /> <uses-feature android:glEsVersion="0x00020000" /> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24" /> <permission android:name="--.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <application android:debuggable="false" android:icon="@drawable/app_icon" android:label="@string/app_name"> <meta-data android:name="applovin.sdk.key" android:value="--" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ --" /> <receiver android:name="com.androidnative.features.notifications.LocalNotificationReceiver"> <intent-filter> <action android:name="com.androidnative.local.intent.OPEN" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver> <!-- BEGIN playfab gcm receiver --> <receiver android:name="com.google.android.gms.gcm.GcmReceiver" 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="--" /> </intent-filter> </receiver> <receiver android:name="com.playfab.unityplugin.GCM.NotificationPublisher" android:enabled="true" android:exported="false" /> <service android:name="com.playfab.unityplugin.GCM.PlayFabGcmListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> </intent-filter> </service> <service android:name="com.playfab.unityplugin.GCM.PlayFabInstanceIDListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.android.gms.iid.InstanceID"/> </intent-filter> </service> <service android:name="com.playfab.unityplugin.GCM.PlayFabRegistrationIntentService" android:exported="false"/> <service android:name="com.playfab.unityplugin.PlayFabUnityAndroidPlugin" android:exported="false" android:stopWithTask="true"/> <!-- END playfab gcm receiver --> <service android:name="com.androidnative.features.notifications.LocalNotificationService" /> <service android:name="com.androidnative.gcm.GcmIntentService" /> <!-- BEGIN for playfab gcm activiry --> <activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" 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> </activity> <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"> <meta-data android:name="android.app.lib_name" android:value="unity" /> <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" /> </activity> <!-- END for playfab gcm activiry --> <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" /> <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" /> <activity android:name="com.unity3d.player.UnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name" android:screenOrientation="landscape"> <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" /> <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.unity3d.player.VideoPlayer" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name" android:screenOrientation="landscape" /> <activity android:name="com.androidnative.AndroidNativeProxy" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <activity android:name="com.androidnative.OAuthProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <activity android:name="com.androidnative.billing.core.AN_BillingProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <activity android:name="com.androidnative.gms.core.GooglePlaySupportActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <activity android:name="com.androidnative.features.social.common.SocialProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" /> </application> <uses-permission android:name="com.android.vending.BILLING" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="--.permission.C2D_MESSAGE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> </manifest>

Build works fine. There is no errors.

If I send a private push through the game manager (in players), the following error occurs.

Failed to deliver to mobile device. Check that the device is registered for push notifications. Error: Android Push Notification Failed: Client has been unregistered for push notifications.

Can anyone help me with something?

10 |1200

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

Marco Williams avatar image
Marco Williams answered

Hi It sounds like you might have accidentally removed some of the files that you need.

Please see:

https://github.com/PlayFab/UnitySDK/tree/master/PluginsSource/UnityAndroidPluginSource#7-resolving-jar--aar-conflicts


You'll notice all the files that are required for our Plugin to work properly. These dependencies are needed in your project, along with the PlayFabUnityAndroid.aar


You can cross reference to this manifest to ensure you have all the right parts in your manifest.
https://github.com/PlayFab/UnitySDK/blob/master/PluginsSource/UnityAndroidPluginSource/playfabunityplugin/release/AndroidManifest.xml

Also I found some conflicting activities in your manifest ( LocalNotificationReceiver ) and some other things that I'm not sure what they are but could be definitely causing a problem if they are intercepting the Notification before our Listener Service.

Let me know if you still have issues after reviewing that.

10 |1200

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

fivefinger2015 avatar image
fivefinger2015 answered

Thank you for your answer.

I cannot resolve this problem yet.

1. aar conflict

The ultimate mobile asset already has the following files:

(The ultimate mobile asset is the latest version updated in November.)

play-services-base.aar

play-services-basement.aar

play-services-gcm.aar

play-services-iid.aar

I deleted the following files in playfab's plugin because it collided at build time.

play-services-base-9.4.0.aar

play-services-basement-9.4.0.aar

play-services-gcm-9.4.0.aar

play-services-iid-9.4.0.aar

On the other hand, if I delete files in the above asset with leaving the playfab's, it was not build.

Perhaps, do I have to analyze and merge overlapping files? :(

And the appcompat-v7-24.1.1.aar and support-v4-24.1.1.aar files left playfab's.

This is because the version is higher.

2. manifest

I removed the LocalNotificationReceiver related receiver and service items as you noticed.

(They are items that were due to local push notification. Until recently, it worked well.)

And all but the other essentials were removed, but the results were the same.

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.FF.CKS" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24" />
  <permission android:name="com.FF.CKS.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <application android:debuggable="false" android:icon="@drawable/app_icon" android:label="@string/app_name">
    <meta-data android:name="applovin.sdk.key" android:value="--" />
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ -" />
    <receiver android:name="com.google.android.gms.gcm.GcmReceiver" 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="com.FF.CKS" />
      </intent-filter>
    </receiver>
    <service android:name="com.playfab.unityplugin.GCM.PlayFabGcmListenerService" android:exported="false">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
      </intent-filter>
    </service>
    <service android:name="com.playfab.unityplugin.GCM.PlayFabInstanceIDListenerService" android:exported="false">
      <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID" />
      </intent-filter>
    </service>
    <service android:name="com.playfab.unityplugin.GCM.PlayFabRegistrationIntentService" android:exported="false" />
    <service android:name="com.playfab.unityplugin.PlayFabUnityAndroidPlugin" android:exported="false" android:stopWithTask="true" />
	<receiver android:name="com.playfab.unityplugin.GCM.NotificationPublisher" android:enabled="true" android:exported="false" />  
    <service android:name="com.androidnative.gcm.GcmIntentService" />
	
	        <!-- Unity Activities -->
        <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
            android:launchMode="singleTask"
            android:label="@string/app_name"
            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>
        </activity>
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
            android:launchMode="singleTask"
            android:label="@string/app_name"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
        </activity>
        <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
            android:launchMode="singleTask"
            android:label="@string/app_name"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
            <meta-data android:name="android.app.lib_name" android:value="unity" />
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
        </activity>
        <!-- End Unity Activities -->


   
    <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
    <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
    <activity android:name="com.unity3d.player.VideoPlayer" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name" android:screenOrientation="landscape" />
    <activity android:name="com.androidnative.AndroidNativeProxy" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.OAuthProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.billing.core.AN_BillingProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.gms.core.GooglePlaySupportActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.features.social.common.SocialProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
  </application>
  <uses-permission android:name="com.android.vending.BILLING" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.GET_TASKS" />
  <uses-permission android:name="com.FF.CKS.permission.C2D_MESSAGE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
</manifest>


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.