I have decided to implement Firebase notifications into my unity project. The issue is that for notifications I want to use custom image, but that image is also used as app image (app_icon). I tried to modify manifest where I put into MessagingUnityPlayerActivity activity custom notification image (notificon) for displaying notification icon.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
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:label="@string/app_name"
android:icon="@drawable/notificon"
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"/>
</application>
</manifest>
I tried to modify it and delete some tags, but then the build wond compile. I should also mention that I have multiple manifests in my project and tried them to merge together but unsuccessfully. But this shouldnt be the problem since this is the only manifest with android:icon propery.
Thank you
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/small_icon" />
Your AndroidManifest.xml should be like
<?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">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/small_icon" />
<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>
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With