Open fdspbsteam opened 2 years ago
Hi @fdspbsteam,
Could you provide relevant code snippets that make use of the Messaging SDK or Firebase in general? Does the crash occur when the notification is received while the app is running or does it appear after tapping the notification?
@paulinon FirebaseAnalytics.LogEvent(eventName);
Does the crash occur when the notification is received while the app is running or does it appear after tapping the notification?
We cannot reproduce it locally, but we saw in our users events "notification event" and then the crash
Hi @fdspbsteam,
I'm gonna need more than that line of code for this investigation. Given that the error message mentions Messaging, you can narrow down to methods that make use of this product.
@paulinon I`m not sure that I catch your question, could you rephrase please. In my opinion, the root cause displayed on screenshots and the fix is easy.
Hi @fdspbsteam,
To be more specific, I'm referring to code snippets in your implementation that make use of the Firebase Messaging SDK. The screenshots you provided right now are not enough to narrow down what's causing the issue, and we need more context in order to analyze this behavior. This way, we can determine whether the issue is caused by the backend, the SDK, or something else.
I look forward to your cooperation.
@paulinon I added logs into the topic, please, take a look
Hi @fdspbsteam,
We'll need all the information we can get in order to identify what's causing these crashes. If you can't locally reproduce this, we can start with the Firebase-related code you're using. Otherwise, we're just running in circles here.
@paulinon Will be great if your team pushed out Firebase code into open source, we can do all improvements by self...
1) public static void EnableTracking() { FirebaseMessaging.TokenRegistrationOnInitEnabled = true; Crashlytics.IsCrashlyticsCollectionEnabled = true; FirebaseAnalytics.SetAnalyticsCollectionEnabled(true); }
2) FirebaseMessaging.SubscribeAsync
and FirebaseTokenReceived
3) FirebaseAnalytics.SetUserId(id);
4) FirebaseAnalytics.LogEvent(eventName);
@fdspbsteam The Firebase Unity has recently become open source, available https://github.com/firebase/firebase-unity-sdk, and the underlying C++ repo is available here: https://github.com/firebase/firebase-cpp-sdk
As a caveat, we are still working on the development experience and documentation, as it is fairly clunky and hard to understand, especially as some of the products, like Analytics and Messaging, are mostly generated using SWIG.
Hi @fdspbsteam,
Is there a task that follows SubscribeAsync
? Do you have a method named OnTokenReceived()
or OnMessageReceived()
in your code? Your implementation would be easier to interpet if you provide entire functions that use Firebase rather than lines of code.
Hey @fdspbsteam. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Hi @paulinon in our code, we do:
FirebaseMessaging.UnsubscribeAsync(topic); FirebaseMessaging.SubscribeAsync(topic);
we use `EventHandler<TokenReceivedEventArgs> TokenReceived`
**and** `
public static event EventHandler<MessageReceivedEventArgs> MessageReceived`
**implementation** :
`FirebaseMessaging.MessageReceived += OnNotificationMessageReceived;`
` FirebaseMessaging.TokenReceived += OnFirebaseTokenReceived;`
Hi @fdspbsteam,
Could you provide the full functions corresponding to your OnNotificationMessageReceived
and OnFirebaseTokenReceived
events?
Hey @fdspbsteam. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Hi @fdspbsteam,
Could you provide the full functions corresponding to your
OnNotificationMessageReceived
andOnFirebaseTokenReceived
events?
` private void OnNotificationMessageReceived(object sender, MessageReceivedEventArgs args) { FMLogger.vCore("received");
if (args != null && args.Message != null)
{
string pushId = string.IsNullOrEmpty(args.Message.MessageId) ? "null" : args.Message.MessageId;
AppState.PushNotificationId = pushId;
var data = args.Message.Data;
if (data != null)
{
foreach (var kv in data)
{
FMLogger.vCore(string.Format("{0}:{1}", kv.Key, kv.Value));
if (kv.Key == APP_MESSAGE_KEY)
{
string queue = kv.Value;
var msg = UrlSchemeParser.TryParse(queue, AppMessageSource.PushNotification);
if (msg != null)
{
NotificationAppMessageReceived?.Invoke(msg, pushId);
return;
}
}
}
}
}
else
{
Debug.LogError("empty");
}
}`
` private void OnFirebaseTokenReceived(object sender, TokenReceivedEventArgs e)
{
FMLogger.vCore("token received. token:\n" + (e != null ? e.Token : "null"));
string token = (e != null && !string.IsNullOrEmpty(e.Token)) ? e.Token : null;
#if UNITY_ANDROID
if (token != null)
AdjustHelper.SetUninstallToken(e.Token);
#elif UNITY_IOS
TimeoutTaskRunner.Instance.Run(CheckForIOSToken());
#endif
if (token != null)
TokenReceived?.Invoke(token);
}`
Thanks for the additional information, @fdspbsteam. I've relayed this to the team so that they could take a look at this issue. With that, I'll be marking this as a bug for now.
any updates in this?
[READ] For Firebase Unity SDK issues, please report to Firebase Unity open-source
Once you've read this section and determined that your issue is appropriate for this repository, please delete this section.
[REQUIRED] Please fill in the following fields:
Unity editor version: 2019.4.16f1 Firebase Unity SDK version: 8.9.0 Source you installed the SDK: .tgz packages from download archive Problematic Firebase Component: FirebaseInstanceIdReceiver Other Firebase Components in use: Auth, Analytics, Crashlytics, Messaging Additional SDKs you are using: Adjust, Facebook Platform you are using the Unity editor on: Mac Platform you are targeting: iOS, Android Scripting Runtime: IL2CPP
[REQUIRED] Please describe the issue here:
Steps to reproduce:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Regarding our user event, this ANR occurs when a user receives an event notification receive
Relevant Code: