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

Receive pushes when app is closed #1

Closed
lawjeremy opened this issue Jul 2, 2015 · 8 comments
Closed

Receive pushes when app is closed #1

lawjeremy opened this issue Jul 2, 2015 · 8 comments

Comments

@lawjeremy
Copy link
Contributor

Is it possible with this library to receive pushes when the app is closed and out of memory?

@morinel
Copy link
Owner

morinel commented Jul 2, 2015

Sure, use gcm.getLastData() when the app starts or resumes to retrieve the data from the last push notification and act accordingly in your app. See the example for how this could work.

@morinel morinel closed this as completed Jul 2, 2015
@lawjeremy
Copy link
Contributor Author

What I'd like to do is pop up a notification while the app is still closed, prompting them to open it. Is this possible?

@morinel
Copy link
Owner

morinel commented Jul 2, 2015

Well, the notification will be shown in the normal way (either at the top, or as a alertbox you have to click to open the app / dismiss it) If you click it, the app will open / resume and then you should use gcm.getLastData() to do anything specific to process the data in the notification itself.

@morinel morinel reopened this Jul 2, 2015
@lawjeremy
Copy link
Contributor Author

The problem I'm having is that I don't get anything on my device (in the tray or an alert) from the push until I open the app.

@morinel
Copy link
Owner

morinel commented Jul 2, 2015

Do you see the notification being received by the app in logcat?

@lawjeremy
Copy link
Contributor Author

My app is allowed to show notifications. I don't see anything in logcat that looks like a notification, what should I be looking for?

@morinel
Copy link
Owner

morinel commented Jul 2, 2015

Search for "Push notification received" for log category GCMIntentService.

@lawjeremy
Copy link
Contributor Author

Digging through logcat helped me find the problem

[ 07-02 20:52:56.441 25483:25502 D/GCMIntentService ]
(IntentService[GCMIntentService--1]) [5,647] Message received but no message so will make this silent

I had my message key in the payload capitalized

"Message": "Hello World"

There's half a day I'll never get back. Thanks for all your help!

andreybeta referenced this issue in andreybeta/gcmpush Nov 15, 2018
Update FCMService.java to properly handle Android O notification channels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants