-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving a push notification raises a Java exception on my Samsung phone #245
Comments
You can ignore this message - it just indicates that you're not using custom notifications
This one is a bit odd - can you show what you have for it in |
The entries related to firebase are these: <meta-data android:name="com.google.android.gms.version" android:value="12451000"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:value="" android:resource="@color/notification_accent_color"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="MYSHIFTPLANNERv1"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:value="" android:resource="@drawable/ic_notification"/> and <service android:name="com.google.android.gms.ads.AdService" android:enabled="true" android:exported="false"/>
<service android:exported="false" android:name="com.delphiworlds.kastri.DWFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.google.firebase.components.ComponentDiscoveryService" android:directBootAware="true" android:exported="false">
<meta-data android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.datatransport.TransportRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
</service> If these aren't what you meant, let me know |
Yes, this one in particular: <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:value="" android:resource="@drawable/ic_notification"/> I've now realized that this line of code might be incorrect: TOSMetadata.GetValue(cMetadataFCMDefaultNotificationIcon, LIcon); Since LIcon is a string, and I expect if the resource is actually there, it's really an integer. Not sure why this hasn't been a problem before. Can you try changing the code so that Also, when including multiple lines of code on comment, you can use 3 backticks (```) at the beginning and end, and it also accepts a format specification for supported types at the beginning marker, like: ```xml and ```delphi etc. |
Thanks Dave, I'll try that and report back. I can never remember the correct markdown syntax for code so thanks for the reminder. I used 2 backticks so almost there! |
Same error I'm afraid.
to confirm, the changed method is procedure TPlatformFCMManager.MessageReceivedNotificationHandler(const Sender: TObject; const AMsg: TMessage);
var
LIcon: Int64;
LIntent: JIntent;
begin
if ShowBannerIfForeground and IsForeground then
begin
LIntent := TMessageReceivedNotification(AMsg).Value;
TOSMetadata.GetValue(cMetadataFCMDefaultNotificationIcon, LIcon);
TJDWNotificationPresenter.JavaClass.presentNotification(TAndroidHelper.Context, LIntent, StringToJString(FChannelId), LIcon);
end;
end; |
Perhaps you have no valid small icon? ;-) I'll see if I can find out what the issue is... |
I checked my deployment settings, output folder etc and it all seems correct. ic_notification.png is in the correct res folders, correct size and none are corrupt. Everything it needs seems to be there, so must be something else causing it not to be able to find the icons at runtime. Thanks |
Sorry, I meant to comment here a few days ago when I pushed a fix. Can you check whether it works for you now? |
In DW.FCMManager.Android.pas, the call to presentNotification() is raising a Java exception which is crashing my app.
Delphi 12.1, running the latest Kastri sources on a Samsung Note 20, Android 13.
The error is:
Just before it, in the logcat output are these, which may be relevant:
and
The text was updated successfully, but these errors were encountered: