-
Notifications
You must be signed in to change notification settings - Fork 10
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
Couldn't make it work when app is killed [android] #3
Comments
sorry to take it so long to respond. I was working on fcm project. |
This is probably the same issue I pointed out in commit comment. |
change new GcmPackge() to new GcmPackage(getIntent() in MainActivity.java |
Will try. It would be great if this helped. |
It starts fine without |
Sorry I don't have any project using this plugin now. Can you debug into |
I don't have clue how. I am not developing in Java, I am just doing PN project in WebStorm. But here is report from fabric:
|
at com.oney.gcm.GcmModule.convertJSON(GcmModule.java:118) so here is the issue. seems like something null is passed into the function |
try this: |
I use Android Studio to debug native code and it is convenient and has better logging |
Yeah, that much I could conclude as well (I mean, the This happens at the normal start of the app. IIRC you have added the JSON parsing into Java part and it wasn't there before. I think the problem is that with plain start of the app, there is no initial notification (and therefore, null). Maybe it should be Working on something else, but will see at it later. |
good catch! |
another solution is checking if |
I changed the appropriate part to: if (mIntent != null) {
Bundle bundle = mIntent.getBundleExtra("bundle");
if (bundle != null) {
String bundleString = convertJSON(bundle);
Log.d(TAG, "bundleString: " + bundleString);
constants.put("initialNotification", bundleString);
}
} but the problem is that I cannot get any events in the app itself. Because of this in if (mIntent == null) {
listenGcmRegistration();
listenGcmReceiveNotification();
getReactApplicationContext().addLifecycleEventListener(this);
} I presume it all needs a bit of redesign, |
That is, I think every |
you don't get any events because
|
I'm not getting any action because |
Are you sure that your above code is able to get both inital notification, device id registration and subsequent push notification while app is live? Because that's what is not working - getting both. Now the |
Unless I do not understand something and |
if you start app normally, getIntent() with return an Intent with |
the code above is just for inital notification. It is RN's getContants method. |
But again, if I pass |
oh man, the code needs so much refactoring... Are you sure you can't upgrade to firebase cloud messaging? |
(that is, not at the same time, but, pls:
FCM is part of firebase3, which is not working with RN. |
What I was suggesting, |
fcm is working for RN. It is GCM with another name. Check https://github.com/evollu/react-native-fcm. |
That's what I was suggesting, keep the null check but you need add smarter check to it: Discriminate between two cases:
Now it discriminates between:
The "normal start w/ getIntent()" ending up with "do not listen" is incorrect. Libin Lu wrote:
|
agreed. let me work on it later today or tomorrow and try to fix the code |
BTW thanks for pointing to fcm working in RN, I had the impression it is part of firebase3, which is not RN compatible yet. |
if you decide to use FCM, I will drop support for this library. It is just an headache to maintain an outdated library and code not written by me |
Will look if it is usable tomorrow. |
cool. I will wait for your updates then |
Hi, I'm running into the same problem. From what I see in FCM repository, there seems to be a lot of issues to solve still. Is there a partial fix at least for the time being? |
issues in FCM is mostly configuration issue and use questions |
not yet. I am going to, I'll keep you posted |
From the documentation, it sounds like FCM does not support notifications sent when app is killed : is that really the case? If so, there's no point for me to switch just yet. |
it should support as FCM runs on the same framework as GCM |
I meant from the |
oh, if you want to show banner when app is killed/ in background, you should always use |
Ok thanks, I will try this. May I suggest you to create a gitter chat room for this repository ? I'm sure it would make things easier for this type of conversation. |
gitter chat created for fcm repo |
thanks! |
I am working on push notification for my app. I followed instructions from documentation. The app notifies me when app is on background but not when app is killed. Am I missing something?
The text was updated successfully, but these errors were encountered: