I am trying to implement push notification in my android application through quickblox API.
All the steps (registration, create push token , create subscription )are successfully executed but finally its throwing the following error message.
"No recipients. At least one user should be subscribed for GCM
(Android Push) (through SDK or REST API)"
I am not getting getting any clue on this error
I had same problem in iPhone. You are trying to send push notification to the user who has not subscribe yet or no one has subscribed for push notification.
What can you do : - run your application in actual device and run application in simulator with different login. And try to send push notification.
To which user you send Push Notification?
I thing you are trying to send push to user which is not subscribed for GCM (Android Push), and you got an error: "No recipients. At least one user should be subscribed for GCM (Android Push)"
You must register your device through the method GCMRegistrar.register() , please try to run on real phone rather than emulator. I also got the same error. But it was resolved
Updating my answer, I solved this issue,
After subscription of push just logout from Quickblox to receive push notification.
Related
We have an app built in React which uses OneSignal via a PHP API to send push notification. Everything looks to be working according to the OneSignal dashboard however no notifications are being received on the device. However we can manually send a test from OneSignal and it comes through to the device.
We have been through the troubleshooting and FAQs on OneSignal but nothing seems to help.
OneSignalMessage::create()
->subject($subject)
->body($this->message->content)
->setData('to', $this->message->chat->makeUrl($notifiable->club))
->setParameter('ios_badgeType', 'Increase')
->setParameter('ios_badgeCount', 1);
One nuance: "Delivered" refers to the notification request being delivered to Apple and Google. It does not confirm that the device itself received it. Please contact our support channel at OneSignal.com for further support.
My app is using Google's C2DM (push notification) to notify users about new activity from friends. Once they install the app I register the device with C2DM servers and store user's phone number. So I know that the user is using my app and I can send him/her the push notifications. But what happens if users uninstalls my app, is there a way to catch it in my app? Or the only way is to catch an error on my server when I send a C2DM and it's unreachable, then mark a user as inactive?
I would love to notify users when their friends are using an app and when they no longer do.
What's is the best solution for this scenario?
The GCM documentation explains this situation here:
https://developers.google.com/cloud-messaging/registration#how-uninstalled-client-app-unregistration-works
"An application can be automatically unregistered after it is uninstalled from the device. However, this process does not happens right away, as Android does not provide an uninstall callback."
Basically when GCM tries to send the next push notification, the device will tell GCM the receiving application was uninstalled.
As for notifying friends that their friends aren't using the app any more, GCM will send a NotRegistered error to your notification server when this failure occurs; it won't be immediate, but could you use that?
Unfortunately the ACTION_PACKAGE_REMOVED intent will be sent out to all receivers except for your own. This is confirmed here.
Some questions for your C2DM plan, since I'm not very familiar with it. If the user just leaves their device off for a long period of time, will that trigger the error condition you use? How does C2DM actually report an "unreachable" device? Is that a condition that only occurs when it attempts to send the push notification and fails or is it when it somehow determines it reaches the device but fails to be handled properly? Obviously in the second scenario your plan would work, but I can see some "false positives" occurring otherwise.
Older SO question for reference: android not receiving Intent ACTION_PACKAGE_REMOVED in the removed package
Yes, but it is quite hacky.
The method is based on the fact that the first thing android does when uninstalling your app is deleting your data file. So you could use a file watcher to detect the deletion.
Also you need to write this in native code. If you write your code in java, your app will be uninstalled before it could execute any code.
please see this demo : https://github.com/sevenler/Uninstall_Statics
Google C2DM service is working in passive mode when it comes to detecting uninstalled applications.
First push notification after uninstalling your application (without unregistering from C2DM!!!) will NOT return any error in response. However, the second push notification will return an "invalid registration" or "not registered" error codes where you can realize the application was uninstalled.
The reason is that C2DM servers return the response code immediately and only then tries to push the client. When client respond that an application was uninstalled, it is deleted from C2DM servers. Next push attempt will return an error code immediately.
I have some points to tell you ,
Android community recommends you to use GCM instead of C2DM as it's no longer available.
In android there is no way for applications to get itself notified that app is getting uninstalled.
in GCM if you want to stop sending messages to uninstalled apps you can refer this
When you send messages to GCM from your server you will get response string.In that if you are getting error as "NotRegistered, you should remove the registration ID from your server database because the application was uninstalled from the device or it does not have a broadcast receiver configured to receive com.google.android.c2dm.intent.RECEIVE intents."
I know only one way with server response 200 with "NotRegistered" message in body.
NotRegistered — The registration_id is no longer valid, for example user has uninstalled the application or turned off notifications. Sender should stop sending messages to this device.
Look into this GCM doc:
GCM Unregistration
You should never unregister your app. This is taken care from server side.
To detect app uninstallation using Google Play Services, you can use the App Uninstallation Reporting API. This API allows you to receive notifications when your app is uninstalled by users. #ThanksChatGPT
Push notifications have stopped working for me. I have tried sending notifications through the Appcelerator dashboard but the request fails with the log GCM Error 3009 (see image attached below). My GCM configuration with Appcelerator's Arrow Cloud Service has not changed and has worked previously. I did update my project from 5.3 to 5.5.1 but going back to the previous version didn't fix the issue.
On the app side, I confirm that I am successfully getting a push notification token, logging into ACS, and subscribing to a channel.
Because Arrow Cloud Service is our server in relations to GCM, I'm not sure what I can do.
What worked for me was:
1) log the device token of the device not receiving the push,
2) in the appc dashboard, go to the Devices tab and unsubscribe the android device with the matching token.
3) re-launch the app, make sure you're subscribed successfully, and the device should now receive push notifications.
I'm trying to set up the messages module in the QuickBlox SDK. I'm able to register in GCM and send the push according to the logs. The problem is that I never get the push notification.
I tried with the default sample keys and with my own. I tried with server key and browser key and nothing.
Let me know what information you need so we can resolve this :(
In the QB console I get this:
Notification has been successfully added to queue
I tried from the development and production environments and nothing happens.
My app is using Google's C2DM (push notification) to notify users about new activity from friends. Once they install the app I register the device with C2DM servers and store user's phone number. So I know that the user is using my app and I can send him/her the push notifications. But what happens if users uninstalls my app, is there a way to catch it in my app? Or the only way is to catch an error on my server when I send a C2DM and it's unreachable, then mark a user as inactive?
I would love to notify users when their friends are using an app and when they no longer do.
What's is the best solution for this scenario?
The GCM documentation explains this situation here:
https://developers.google.com/cloud-messaging/registration#how-uninstalled-client-app-unregistration-works
"An application can be automatically unregistered after it is uninstalled from the device. However, this process does not happens right away, as Android does not provide an uninstall callback."
Basically when GCM tries to send the next push notification, the device will tell GCM the receiving application was uninstalled.
As for notifying friends that their friends aren't using the app any more, GCM will send a NotRegistered error to your notification server when this failure occurs; it won't be immediate, but could you use that?
Unfortunately the ACTION_PACKAGE_REMOVED intent will be sent out to all receivers except for your own. This is confirmed here.
Some questions for your C2DM plan, since I'm not very familiar with it. If the user just leaves their device off for a long period of time, will that trigger the error condition you use? How does C2DM actually report an "unreachable" device? Is that a condition that only occurs when it attempts to send the push notification and fails or is it when it somehow determines it reaches the device but fails to be handled properly? Obviously in the second scenario your plan would work, but I can see some "false positives" occurring otherwise.
Older SO question for reference: android not receiving Intent ACTION_PACKAGE_REMOVED in the removed package
Yes, but it is quite hacky.
The method is based on the fact that the first thing android does when uninstalling your app is deleting your data file. So you could use a file watcher to detect the deletion.
Also you need to write this in native code. If you write your code in java, your app will be uninstalled before it could execute any code.
please see this demo : https://github.com/sevenler/Uninstall_Statics
Google C2DM service is working in passive mode when it comes to detecting uninstalled applications.
First push notification after uninstalling your application (without unregistering from C2DM!!!) will NOT return any error in response. However, the second push notification will return an "invalid registration" or "not registered" error codes where you can realize the application was uninstalled.
The reason is that C2DM servers return the response code immediately and only then tries to push the client. When client respond that an application was uninstalled, it is deleted from C2DM servers. Next push attempt will return an error code immediately.
I have some points to tell you ,
Android community recommends you to use GCM instead of C2DM as it's no longer available.
In android there is no way for applications to get itself notified that app is getting uninstalled.
in GCM if you want to stop sending messages to uninstalled apps you can refer this
When you send messages to GCM from your server you will get response string.In that if you are getting error as "NotRegistered, you should remove the registration ID from your server database because the application was uninstalled from the device or it does not have a broadcast receiver configured to receive com.google.android.c2dm.intent.RECEIVE intents."
I know only one way with server response 200 with "NotRegistered" message in body.
NotRegistered — The registration_id is no longer valid, for example user has uninstalled the application or turned off notifications. Sender should stop sending messages to this device.
Look into this GCM doc:
GCM Unregistration
You should never unregister your app. This is taken care from server side.
To detect app uninstallation using Google Play Services, you can use the App Uninstallation Reporting API. This API allows you to receive notifications when your app is uninstalled by users. #ThanksChatGPT