cordova-plugin-firebasex
cordova-plugin-firebasex copied to clipboard
java.lang.NullPointerException when notification recieved when app in the foreground
Bug report
CHECKLIST
-
[X] I have read the issue reporting guidelines
-
[X] I confirm this is a suspected bug or issue that will affect other users
- [X] I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
- [X] I have read the documentation thoroughly and it does not help solve my issue.
- [X] 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 https://github.com/dpa99c/cordova-plugin-firebasex/blob/ddbaccc45c3da39e5b4a6fb8255935d372cfe275/src/android/FirebasePluginMessagingService.java#L152
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
Looks like this bug was introduced by PR #667
@ollm as PR author, are you able to submit a PR to fix this bug?
Fixed by #709 which is merged and will be published with next release
Wow, thank you and @rokkreslincom for the quick turnaround on this
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.
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..
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.
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.