yalcin-ata / godot-android-plugin-firebase

Godot 3.2.2 Android plugin for Firebase
44 stars 12 forks source link

[Answers] for "How to show custom icon in the notification?" and "How to receive Firebase Cloud Messaging callbacks?" #16

Open TIBI4 opened 3 years ago

TIBI4 commented 3 years ago

I don't know where to submit this, and this repository has been very useful for me. Firebase Cloud Messaging worked like a charm!, but a few things happened before.

I would love if this repository is more visible and more updated by @yalcin-ata ... But I know that every person has it's own business and stuff to do.

These questions are some things that I was able to fix by myself. (In addition to the get_token() method.)

For this, you need to edit your AndroidManifest.xml and then compile following this steps to look like this:

If you want to understand what you are doing read this documentation from Firebase.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.godotengine.androidplugin.firebase">

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

<application>
    <!-- How to show custom icon in the notification? -->
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_stat_ic_notification" />
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorAccent" />

    <!-- Does not change. -->
    <meta-data
        android:name="org.godotengine.plugin.v1.Firebase"
        android:value="org.godotengine.androidplugin.firebase.Firebase" />

    <!-- How to receive Firebase Cloud Messaging callbacks? -->
    <service
        android:name="org.godotengine.androidplugin.firebase.CloudMessagingService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
</application>