Skip to content
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

java.lang.NullPointerException when notification recieved when app in the foreground #708

Open
5 tasks done
mleech opened this issue Feb 14, 2022 · 8 comments
Open
5 tasks done
Labels
android Relates to Android platform bug Something isn't working properly Cloud Messaging Related to Firebase FCM / Push Notifications / APNS

Comments

@mleech
Copy link

mleech commented Feb 14, 2022

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:

When app is in the foreground onMessageReceived is not triggered.
The following line appears in the console output:

[ng] [console.error]: "FirebasePlugin[native]: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference"

I believe the source of the error is the following line (152):

image = notification.getImageUrl().toString();

in FirebasePluginMessagingService.java

image = notification.getImageUrl().toString();

notification.getImageUrl() can return null (see: https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/RemoteMessage.Notification#public-uri-getimageurl), but this code doesn't handle that case.

Expected behavior:

onMessageRecieved should trigger without error

@dpa99c
Copy link
Owner

dpa99c commented Feb 14, 2022

Looks like this bug was introduced by PR #667

@ollm as PR author, are you able to submit a PR to fix this bug?

@dpa99c dpa99c added android Relates to Android platform bug Something isn't working properly Cloud Messaging Related to Firebase FCM / Push Notifications / APNS labels Feb 14, 2022
@dpa99c
Copy link
Owner

dpa99c commented Feb 14, 2022

Fixed by #709 which is merged and will be published with next release

@mleech
Copy link
Author

mleech commented Feb 14, 2022

Wow, thank you and @rokkreslincom for the quick turnaround on this

@renemadsen
Copy link

renemadsen commented Mar 2, 2022

Fixed by #709 which is merged and will be published with next release @dpa99c

When is that released? Kind og breaks our code right now.

@ZaLiTHkA
Copy link

ZaLiTHkA commented Mar 7, 2022

When is that released? Kind og breaks our code right now.

@renemadsen I suggest you install this plugin at the specific commit that includes this fix, then subscribe to this issue to see when it's closed, or even subscribe to the repo as a whole to see when a new update is released.

I've installed this in my project using the following:

cordova plugin add https://github.com/dpa99c/cordova-plugin-firebasex.git#751ba5a35fe7461731cde6a1ea5fd1b973941572

obviously appending any --variable arguments your own project requires..

@quadrofolio
Copy link

Well, its now been nearly 3 months that the 14.0.0 was released which is broken for Android but works in IOS. So for Android I need either the specific commit OR use the previous 13.0.0 version and of course those both do NOT work in IOS because of issues with the LD_RUN... etc. The set of steps to take in IOS is also pretty much a nightmare.

Let me paint a picture of the only set of steps that currently works for IOS if the last one you worked on was Android:

  • remove [email protected] from package.json (that works in Android)
  • comment all firebasex imports and code in src
  • delete package-lock.json and node_modules
  • do fresh npm install
  • ionic cordova platform add ios
  • ionic cordova build ios --prod
  • open .xcworkspace
  • set dev team + goto build settings -> signing -> Code signing identify and choose IOS developer
  • build settings --> linking --> Runpath Search paths and add the $(inherited) to both debug and release items in this category
  • build to simulator
  • close xcode/simulator
  • now we can add the plugin back and uncomment all the code in .src
  • back to xcode to test or release the code.

And of course the other way round if you then need to do an Android release. Love your plugin but feel my pain ;-)

Could we get an ETA on a next release please?

@cinnamon-doge
Copy link

This is creating some major issues for me as well, trying to maintain simultaneous Android and iOS releases for my app. Not trying to be negative, just a bit puzzled by the lack of a new version release here.

@cinnamon-doge
Copy link

Well, its now been nearly 3 months that the 14.0.0 was released which is broken for Android but works in IOS. So for Android I need either the specific commit OR use the previous 13.0.0 version and of course those both do NOT work in IOS because of issues with the LD_RUN... etc. The set of steps to take in IOS is also pretty much a nightmare.

Let me paint a picture of the only set of steps that currently works for IOS if the last one you worked on was Android:

* remove [email protected] from package.json (that works in Android)

* comment all firebasex imports and code in src

* delete package-lock.json and node_modules

* do fresh npm install

* ionic cordova platform add ios

* ionic cordova build ios --prod

* open .xcworkspace

* set dev team + goto build settings -> signing -> Code signing identify and choose IOS developer

* build settings --> linking --> Runpath Search paths and add the $(inherited) to both debug and release items in this category

* build to simulator

* close xcode/simulator

* now we can add the plugin back and uncomment all the code in .src

* back to xcode to test or release the code.

And of course the other way round if you then need to do an Android release. Love your plugin but feel my pain ;-)

Could we get an ETA on a next release please?

This is creating some major issues for me as well, trying to maintain simultaneous Android and iOS releases for my app. Not trying to be negative, just a bit puzzled by the lack of a new version release here.

The issue is fixed for me by the 14.1 release - I no longer need to juggle the version for Android and iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Relates to Android platform bug Something isn't working properly Cloud Messaging Related to Firebase FCM / Push Notifications / APNS
Projects
None yet
Development

No branches or pull requests

6 participants