flurry / unity-flurry-sdk

Unity plugin for Flurry SDK
Apache License 2.0
25 stars 5 forks source link

Push notifications not received on Android device #3

Closed SajjadAlimohammadi closed 5 years ago

SajjadAlimohammadi commented 5 years ago

I implemented the SDK and Analytics is working correctly but when I try to send push notifications from Flurry dashboard, I Didn't receive any notification on my android devices. By the way I can send pushes from Firebase on this App. I tried on both dashboards on and use token that generated in project and on Flurry project I didn't receive notification but from Firebase and the same token I had received notification.

poting-oath commented 5 years ago

@SajjadAlimohammadi Please follow the Flurry Push section under Android Installation in README.

  1. Rename AndroidManifest_Flurry-template.xml to AndroidManifest.xml
  2. Update the metadata section in your AndroidManifest.xml

Note: merge either AndroidManifest.xml or FlurryUnityApplication.java, if you already have your own manifest or Application.

SajjadAlimohammadi commented 5 years ago

@poting-oath Thanks for your reply. I was start an empty project and import SDK, Then made the changes that you mention. But the result didn't change.

poting-oath commented 5 years ago

@SajjadAlimohammadi

Thanks!

SajjadAlimohammadi commented 5 years ago

@poting-oath thanks for your advise,

Do you install and setup Firebase Cloud Messaging in your new project? (and Firebase console reports that it sees your app running)

Yes I implement Firebase Cloud Messaging.

After that, do you see a file google-services.json in your project's Android folder?

There is no Android folder in root of project and as mentioned in Firebse Doc the file had to be in Assets: https://firebase.google.com/docs/unity/setup#add_config_file and in my project it is there.

Remember to Set up "Android Authorization" in Flurry Push Authorization (https://developer.yahoo.com/flurry/docs/push/authorization/)

I did Authorization and get the green light.

You can see project manifest here:



<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="2" android:versionName="0.2.0" package="cccc.ccc.ccc" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

  <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="26"/>

  <!-- Application -->
  <application android:icon="@drawable/app_icon" android:label="@string/app_name">

    <!-- Unity Main Activity -->
 <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" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
   </activity>

    <!-- Your Firebase identificators -->
    <meta-data android:name="ymp_gcm_default_sender_id" android:value="number:XXXXXXXX"/>
    <meta-data android:name="ymp_firebase_default_app_id" android:value="1:XXXXXXXX"/>

  </application>

</manifest>
poting-oath commented 5 years ago

@SajjadAlimohammadi Thanks for your info! Please follow the Flurry Push section under Android Installation in README. Because you have your own AndroidManifest.xml, you need to merge, instead of rename, it with our AndroidManifest_Flurry-template.xml Especially the following parts:

...
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:name="com.flurry.android.FlurryUnityApplication"
...        
        <!-- Flurry Agent settings; please update -->
        <meta-data android:name="flurry_apikey" android:value="FLURRY_ANDROID_API_KEY" />
        <meta-data android:name="flurry_with_crash_reporting" android:value="true" />
        <meta-data android:name="flurry_with_continue_session_millis" android:value="10000L" />
        <meta-data android:name="flurry_with_include_background_sessions_in_metrics" android:value="true" />
        <meta-data android:name="flurry_with_log_enabled" android:value="true" />
        <meta-data android:name="flurry_with_log_level" android:value="2" />
        <meta-data android:name="flurry_with_messaging" android:value="true" />
...
        <!-- Flurry Messaging services; do not modify -->
        <service android:name="com.flurry.android.marketing.messaging.FCM.FlurryMessageListenerService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

        <service android:name="com.flurry.android.marketing.messaging.FCM.FlurryInstanceIDListenerService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>

        <receiver
            android:name="com.flurry.android.marketing.messaging.notification.NotificationCancelledReceiver"
            android:enabled="true"
            android:exported="false">
        </receiver>

        <receiver
            android:name="com.flurry.android.marketing.messaging.notification.NotificationClickedReceiver"
            android:enabled="true"
            android:exported="false">
        </receiver>

    </application>

</manifest>
poting-oath commented 5 years ago

Actually if you are not using Firebase. You can just replace your AndroidManifest.xml with our AndroidManifest_Flurry-template.xml.

poting-oath commented 5 years ago

@SajjadAlimohammadi Does the suggested fix work for you? We may close this issue if not received further issue. Thanks!

SajjadAlimohammadi commented 5 years ago

@poting-oath Thanks for your suggestion it's solved my issue.