Unity Android - Launch App From Push Notification

0 votes
Hi there. So my question is simple, and this has worked before, but I was looking to find out how to open my app from the push notification I receive from it. When I press the notification, the Unity game doesn't launch and the notification just disappears. I included my manifest file as an attachment. I have an additional question on the same topic, but I'll create a new question for that one. Thanks in advance.
image
closed with the note: [Solved] This question is now closed and has been solved.  Thank you :)
asked Mar 16, 2016 in Android by null (23 points)
closed Mar 18, 2016 by null

1 Answer

+1 vote

Hi,

Thanks for sharing AndroidManifest.xml file. You have integrated in properly but as I am going through with your Manifest file I will found two Service and two Receiver there, So If the notification is override by other service and receiver, that may be a reason you are unable to launch the unity application.

Will you please share more logs of Android logcat that will help me to exactly track the problem.

Let me know if more queries are concern.

Thanks

Vishnu Garg


 

answered Mar 17, 2016 by Vishnu Garg (674 points)
Thanks, Vishnu!  

You were right, here is my new manifest.  It seems like Union Assets (A Unity plugin), and a few other plugins I used in the past edited the manifest and added a few things that weren't even necessary.

Here is the new XML.  Is the service/receiver that you mentioned now fixed?:

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <permission android:name="com.GameEverything.TicTaco.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <application android:icon="@drawable/bearloadinghead" android:label="@string/app_name" android:debuggable="true" android:name="io.fabric.unity.android.FabricApplication">
    <meta-data android:name="com.google.android.gms.version" android:value="7571000" />
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 173600188015" />
    <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ 173600188015" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb114884508890460" />
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <meta-data android:name="onMessageOpen" android:value="com.unity3d.player.UnityPlayerActivity" />
    <meta-data android:name="push_title" android:value="TicTaco" />
    <intent-filter>
      <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
      <category android:name="com.GameEverything.TicTaco" />
    </intent-filter>
    <receiver android:name="com.shephertz.app42.push.plugin.App42GCMReceiver" 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.GameEverything.TicTaco" />
      </intent-filter>
    </receiver>>
    <service android:name="com.shephertz.app42.push.plugin.App42GCMService"/>
    <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" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    <activity android:name="com.facebook.LoginActivity" android:configChanges="keyboardHidden|orientation" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <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.FBUnityDeepLinkingActivity" android:exported="true" />
    <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.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider114884508890460" android:exported="true" />
    <activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  </application>
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="com.android.vending.BILLING" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="com.GameEverything.TicTaco.permission.C2D_MESSAGE" />
  <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="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
If you still need the logcat, I'll send it in the next reply.  Let me know.  Thanks.
You have to remove unnecessary intent filter like :
 <intent-filter>
      <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
      <category android:name="com.GameEverything.TicTaco" />
    </intent-filter>

Please do testing and let me know if still having the same problem at that time share logcat logs.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...