Giter VIP home page Giter VIP logo

godot-firebase-cloudmessaging's Introduction

Firebase Cloud Messaging plugin for Godot engine.

Installation

Use NativeLib Addon or NativeLib-CLI for installation.

Don't forget to put file google-services.json in folder android/build before exporting project.

For iOS:

  • ensure that plugin NativeLib-Export installed and enabled
  • add GoogleService-Info.plist in addons/nativelib-export/iOS

Setup custom notification icon for Android

  1. After NativeLib FCM setup notifications will show up without your desired "notification_icon.png" but a white square ot something you didn't want.

  2. Add the white notification icon notification_icon.png under yourgodotproject/android/build/res/mipmap/.

  3. In the AndroidManifest.xml under yourgodotproject/android/build/ inside :

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/notification_icon" />

Usage

Subscribe for two signals:

    messaging.connect('token_received', self, '_on_token_received')
    messaging.connect('message_received', self, '_on_message_received')

func _on_token_received(token: String) -> void:
    pass

func _on_message_received(message: Dictionary) -> void:
    pass

Also you can check token during app initialization:

token = messaging.get_token()

godot-firebase-cloudmessaging's People

Contributors

drmoriarty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

godot-firebase-cloudmessaging's Issues

Class 'PluginClass' already exists

Initialize FirebaseCloudMessaging
ERROR: Class 'PluginClass' already exists.
At: core/class_db.cpp:581:_add_class2() - Condition "classes.has(name)" is true.
ERROR: Class 'PluginClass' already exists.
At: core/class_db.cpp:581:_add_class2() - Condition "classes.has(name)" is true.

my plugins:

screenshot

Can't get token

I'm trying to get my device token for using push notifications via Firebase. After installing your plugin and setting up the token_received signal, the signal never fires and messaging.get_token() returns null. I have google-services.json in my projects android/build folder.

I am using Godot 3.3.4.

Fatal Exception: java.lang.NullPointerException

Got this error report from Crashlytics


Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void ru.mobilap.firebasecloudmessaging.FirebaseCloudMessaging.set_token(java.lang.String)' on a null object reference
       at ru.mobilap.firebasecloudmessaging.MyFirebaseMessagingService.onNewToken(MyFirebaseMessagingService.java:75)
       at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(com.google.firebase:firebase-messaging@@21.0.1:8)
       at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(:1)
       at com.google.firebase.messaging.EnhancedIntentService$$Lambda$0.run(:6)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.android.gms.common.util.concurrent.zza.run(:6)
       at java.lang.Thread.run(Thread.java:919)

How to receive clicks from notification bar

Hey, first thanks so much for the amazing work you've been doing in all these libs for Godot! 👏

One question: do you have a clue on how to capture a message data in the app when the user clicks on it from the notifications bar?

Some context:

When I send push messages remotely and the app is closed or in background, the message goes to the device notifications bar. So far so good.

When the user clicks on this notification, it opens the app, but I'd like to capture this click somehow and react to it. But it doesn't trigger the _on_message_received function.

I tried setting the click_action argument in the message, but then it doesn't even open the app when the message is clicked from the notifications bar. It seems I'd need to set some sort of intent-filter, but after hours I could not figure this out.

No longer receiving tokens

I've noticed that I'm not longer receiving tokens with this addon. I was wondering if there was an update that caused it to no longer work. Is it still working for you? If it's still working for you, then perhaps it's an issue on my end.

Godot 3.3 compatibility

I tested the plugin on Godot 3.3 and is not working, that´s ok or I am making something wrong?

Is this plugin available for iOS?

Hi, I am pretty sure is not compatible but I ask just in case, I need push notifications on iOS and I cannot find something, this is the closest I got

Undefined symbols for architecture arm64

When building my project with Xcode I get the following error:

ld: warning: Could not find or use auto-linked framework 'FBLPromises'
Undefined symbols for architecture arm64:
  "Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&)", referenced from:
      FirebaseCloudMessaging::token_received(String) in firebase-cloud-messaging.a(godot_plugin_class.o)
      FirebaseCloudMessaging::message_received(Dictionary) in firebase-cloud-messaging.a(godot_plugin_class.o)
      ____ZN22FirebaseCloudMessagingC2Ev_block_invoke_2 in firebase-cloud-messaging.a(godot_plugin_class.o)
     (maybe you meant: Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&))
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

grafik

The FB-Analytics-plugin is installed and compiled fine.

Occasional crash on startup.

For awhile now my app would sometimes crash when launching. I was just able to trigger a crash when monitoring adb logcat and got this crash log:
05-24 19:58:24.901 7299 7299 E AndroidRuntime: FATAL EXCEPTION: main 05-24 19:58:24.901 7299 7299 E AndroidRuntime: Process: com.company.app, PID: 7299 05-24 19:58:24.901 7299 7299 E AndroidRuntime: java.lang.IllegalArgumentException: Signal token is not registered for this plugin. 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at org.godotengine.godot.plugin.GodotPlugin.emitSignal(GodotPlugin.java:340) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at ru.mobilap.firebasecloudmessaging.FirebaseCloudMessaging.access$300(FirebaseCloudMessaging.java:47) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at ru.mobilap.firebasecloudmessaging.FirebaseCloudMessaging$1.onComplete(FirebaseCloudMessaging.java:70) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at com.google.android.gms.tasks.zzj.run(Unknown Source:4) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7073) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) 05-24 19:58:24.901 7299 7299 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Any idea what could be causing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.