-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Push notification doesn't get to the device #942
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
Comments
The where clause for push are supposedly on _Installation and not _User |
So if I want to send to a specific user, I need the get the Installation ID from that user and query like this?
|
You should set the userId to the installation object, and do:
|
Ok, but that's exactly what I did. I've set the user pointer:
|
Here's this user _Installation data on mongodb
|
@flovilmart may I understand why you close this issue? |
I'm no android specialist, but it looks like the deviceToken is not set on your Installation object |
I am having the same problem. As I have configured only the ios device. As my application is ios based. So I get the error in push. this is the log.
I dont get push on my device. How to solve this problem. |
@flovilmart good point, there's no deviceToken column on _Installation for users who were created after the migration. Any idea why the parse-server might not be creating it? Look at this POST sent from user's first login:
And also just for testing I went on mongodb and updated an user _Installation with a deviceToken. And now when trying to push I got this MismatchSenderId error:
|
hey @mahabubakram, your error message looks similar to mine. They have a problem with the sender. Can you check if there's this column deviceToken on your db? GCM: MismatchSenderId |
@weengo , I am trying to send to an old user. Who is already there in my parse database. So after migration to mongo lab I am trying to send push notification to that user and I have deviceToken to that user. But as you can see push is not going into the device. And I am having this problem for quite a long time but no one has given response on it. |
Ok, got it solved. On my android manifest file I was using the API key, instead of Sender Id. And I was also using key of type Android, but I have now changed to one of type server. So anyone with similar issue remember to check that on the google console. Now my _Installation is receiving the deviceToken normally. And oddly I'm still getting the GCM error:
@mahabubakram I would suggest you create a new user on mongodb, and try to send push to this new user. |
I have the same problem. The notification doesn't reach to device. I run parse server example and try to send notification using rest api curl -X POST The rest response is {"result":true}. I don't see any log in the server and I wonder what is wrong. I am using parse-server 2.2.2 |
@karkaletsis can you show how you're declaring the push on your index.js file? |
@weengo I refer it like this var api = new ParseServer({ |
Bundle id should be you CFBundleIdentifier from your iOS app |
I try to test only android push for now and so I places a random key in bundleId |
@karkaletsis, are you sure to be using a Server key from Google? Does your android manifest has something like this? The XXXX being you senderId:
|
Yes, I have this in my android maniferst xml this entry. Didn't I have to see something in error log both in parse server and google developer logs? |
Yes i have the same problem. On the client side, the push is successfully sent but the device doesn't receive it. Im thinking of just using onesignal.com since parse's push notifications does not support "high throughput" to better invest in a more longterm solution. I'd still like to debug the issue to learn why its not working. |
@karkaletsis I believe you do should see something only if the message is actually being sent. When you run with VERBOSE=1 don't you get nothing? |
@otymartin Could you also run with VERBOSE=1 so we can see what's message when the push is sent? |
How do I enable VERBOSE=1, to curl that posts the message or to the server? and how? |
@weengo How do I do that? I only started learning javascript since the migration so Its a complete gray area. // MARK: - SEND PUSH NOTIFICATION
func sendPushToContact(contact: PFUser) {
PFCloud.callFunctionInBackground("sendPushToContact", withParameters: ["user": contact.objectId!, "params": (PFUser.currentUser()?.valueForKey("name"))!], block: { (result: AnyObject?, error: NSError?) in
if error == nil {
//THIS SUCCEEDS :)
print("Client: Push Sent")
} else {
print("Client: Push Failed")
print(error?.localizedDescription)
}
})
} //SEND PUSH NOTIFICATIONS
Parse.Cloud.define("sendPushToContact", function(request, response) {
// request has 2 parameters: params passed by the client and the authorized user
var params = request.params;
var user = request.user;
// Our "Message" class has a "text" key with the body of the message itself
var messageText = params.text;
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo('user', user); // targeting incomingUser
pushQuery.equalTo('deviceType', 'ios'); // targeting iOS devices only
Parse.Push.send({
where: pushQuery, // Set our Installation query
data: {
alert: "Message: " + messageText
}
}, { success: function() {
console.log("#### PUSH OK");
}, error: function(error) {
console.log("#### PUSH ERROR" + error.message);
}, useMasterKey: true});
response.success('success');
}); |
@Heman6886 i am waiting for your response. can you please help me out with this issue |
Actually u cannot send push to an installation id |
Ok, so i have this same problem. I am trying with a clean Parse Starter Project with only the exact AndroidManifest.xml additions as specified in "https://github.com/ParsePlatform/Parse-Server/wiki/Push-Configuring-Clients" and i have configured my Parse-Server exactly as specified in "https://github.com/ParsePlatform/parse-server/wiki/Push". I am running my own Parse-Dashboard and trying to use that to send a push notification to my android device running the Parse Starter app. Also trying to use the "curl example". Nothing. Nada. What's going on? How do i enable logging inside index.js file to check what's happening? I don't see anything in /logs nor do i see any "_Push folders" being created in my mongo, as f@flovimart commented elsewhere. I am pretty sure my keys and app setup is done proper. I have followed the examples to the T. |
Start your server with VERBOSE=1 as an environment variable and send out the logs related to push sending. |
i'd love to. just can't figure out how to pass that variable directly from inside "index.js". I am running my parse-server on CentOS 7 with nvm and node v 5.10.1 with simple "node index.js" or "pm2 start index.js" EDIT: I started parse-server with pm2 and passing a json config file with the VERBOSE=1 option inside. Save a file with the following inside, and start with "pm2 start /path/to/this/config/file.json" { |
this is an environment variable so, wither VERBOSE=1 node index.js, or in your pm2 configuration |
Logs: From curl. Pretty much similar using Dashboard. verbose: POST /parse/push { 'user-agent': 'curl/7.29.0', |
does the device have the proper deviceTokens? |
Android installation does not add any device tokens. I used the exact tutorial to add the following in a clean ParseStarterProject. // Native: Application.java Though after the latest "parse-server" update to 2.2.7, i notice the schema added more fields such as "DeviceToken, Channels, GcmSender, PushType, Badge". These did not show up in the earlier version "2.2.6". My New installs on a android device, show these fields as empty, though both app and parse-server side are properly configured with GCM ID/Keys. |
does the GCMSender is set? I'm wondering here as there are many users with valid and functioning configurations. |
Of course. In my Parse-Server i have set: push: { here - "senderId is the project ID". "apiKey is the server api key given by google dev console" |
Try to ask over stack overflow. With VERBOSE=1 you should also have logs from the GCM adapter itself. Seems that it's improperly configured to me. |
ok. will do. it's just that we don't really have an active community over on stackoverflow for now. most queries/replies are still related to the older parse.com and lead to a frustrating experience going round in circles. |
@benitech did u use custom reciever for recieving push notification |
no. just added the "ParseInstallation.getCurrentInstallation().saveInBackground();" in the android client side code, as the tutorial says |
have u declare the server url in application activity and which parse library are you using |
you mean, am i connecting to my own parse-server properly? of course. It works fine for other things, i can see my installations and sessions from the starter app right away.
And so far, with Parse-Server, only Parse 1.13.0 can be used. dependencies { |
Please run npm start enable verbose VERBOSE=1 DEBUG=apn,node-gcm npm start |
Same as i posted earlier. verbose: POST /parse/push { 'user-agent': 'curl/7.29.0', |
no device is registered that is the reason please reverify the project id and app key of GCM |
@Heman6886 Actually i updated my parse server to the latest one and it started working. Still there needs to be a proper documentation for others to understand. It was so much of time loss for me, just to make this work. Parse developers need to contribute to these issues and make sure it works for everyone. |
ok |
@Heman6886 |
I'll add a Working Sample for both Parse-Server and Parse-Starter project on my github later. Might help others with any number of config issues in either. |
@sekharrockz yes using cloud code |
O god , The Push Section is a mess , Yet You guys did a fantastic job on bring parse to public ! does my after send How did this even happened LOL I literally got nothing to work with LOL! |
By the way , This is my afterSave Block :`Parse.Cloud.afterSave("OBJECTCLASS",function(req,res){
Parse.Push.send({ |
Hello! |
There is no response object passed as a second argument in afterSave |
Issue
On Cloud Code I have an after save trigger that sends a Push to a specific user, but it doesn't get to the device and I neither get a GCM request and response. Any ideas?
Prerequisites
Log from Verbose
How I initialise Parse Server on index.js
Function on Cloud Code
Possible Similar Issues
The text was updated successfully, but these errors were encountered: