Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Push Notifications don't show up

Discussion in 'Android' started by Good_Punk, Jun 21, 2015.

  1. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    Maybe somebody here can help me with my push notifications. I'm using the plugin/service from Onesignal and setup my programm as instructed.

    It mostly seems to work fine, the device get registered with their servers, no error messages. But when the device receives a push notification it's not displayed on the phone. The only thing I get is I/GCM(3350): GCM message com.rachor.cthulhu 0:1434822732224445%77521151f9fd7ecd when the app is running or

    06-20 17:43:50.131: I/GCM(3350): GCM message com.rachor.cthulhu 0:1434815030418529%77521151f9fd7ecd
    06-20 17:43:50.196: W/GCM-DMM(3350): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.rachor.cthulhu (has extras) }

    when the app was shut down. But no actual notification is shown. I've re-checked the Manifest a 1000 times but couldn't find any errors there.

    Code (JavaScript):
    1. <?xml version="1.0" encoding="utf-8"?>
    2.  
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.rachor.cthulhu" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
    4.     <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    5.    
    6.       <application
    7.      android:icon="@drawable/app_icon"
    8.       android:label="@string/app_name">
    9.  
    10.       <activity
    11.           android:name="com.unity3d.player.UnityPlayerNativeActivity"
    12.         android:label="@string/app_name"
    13.         android:screenOrientation="portrait">
    14.  
    15.          <intent-filter>
    16.             <action android:name="android.intent.action.MAIN" />
    17.             <category android:name="android.intent.category.LAUNCHER" />
    18.          </intent-filter>
    19.  
    20.          <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    21.          <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    22.       </activity>
    23.  
    24.       <receiver
    25.         android:name="com.onesignal.GcmBroadcastReceiver"
    26.         android:permission="com.google.android.c2dm.permission.SEND" >
    27.          <intent-filter>
    28.             <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    29.             <category android:name="com.rachor.cthulhu" />
    30.          </intent-filter>
    31.       </receiver>
    32.      
    33.        <meta-data android:name="billing.service" android:value="google.GooglePlayIabService" />
    34.        <activity android:name="com.soomla.store.billing.google.GooglePlayIabService$IabActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    35.    </application>
    36.  
    37.     <!--<uses-feature android:glEsVersion="0x00020000" />-->
    38.    
    39.     <uses-permission android:name="android.permission.INTERNET" />
    40.     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    41.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    42.     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    43.     <!--library-->
    44.     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    45.     <!-- GCM connects to Google Services. -->
    46.     <uses-permission android:name="android.permission.INTERNET" />
    47.     <!-- GCM requires a Google account. -->
    48.     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    49.     <!-- Keeps the processor from sleeping when a message is received. -->
    50.     <uses-permission android:name="android.permission.WAKE_LOCK" />
    51.     <uses-permission android:name="com.android.vending.BILLING" />
    52.     <uses-permission android:name="android.permission.VIBRATE" />
    53.    
    54.     <permission android:name="com.rachor.cthulhu.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    55.     <uses-permission android:name="com.rachor.cthulhu.permission.C2D_MESSAGE" />
    56.     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    57.  
    58. </manifest>
     
  2. JKasten

    JKasten

    Joined:
    Apr 11, 2013
    Posts:
    23
    Your AndroidManifest.xml looks correct. Which version of Unity are you using? Can you also make sure you have android-support-v4.jar in your Unity project? If that is there could you send us your APK to support@onesignal.com? We can help debug the issue with it.

    Thanks.
     
  3. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    Thanks for the support, everything works fine now! :)
     
  4. Hyper00

    Hyper00

    Joined:
    Aug 4, 2015
    Posts:
    3
    А какой нужен AndroidManifest.xml в FCM(по старому GCM)???
    And what is needed in AndroidManifest.xml FCM (the old GCM) ???