payload is null from server - android

In my app receives the push notification from GCM(for android) everything is fine am getting the notification but the payload is null. Cross checked server side script it's fine. This is the response am getting in callback method
This is the GCM response
{"type":"callback",
"source":{"pushType":"gcm", "invocationAPIs":[],
"showAppOnTrayClick":true,
singleCallback":false,
"__propertiesDefined__":true,
"bubbleParent":true,
"_events":{"callback":{},
"trayClickLaunchedApp":{},
"trayClickFocusedApp":{}},
"focusAppOnPush":false,
"enabled":false,
"showTrayNotificationsWhenFocused":false,
"apiName":"Ti.Module",
"showTrayNotification":true,"debug":false},
"payload":"","bubbles":false,
"cancelBubble":false}
Am using Titanium 3.5.1GA and tried with ti.cloudpush(3.3.7) same issues .
How can i solve it?

Since the notification does arrive it's probably not an error in the app but on the server sending the payload. Try one of the several (online) apps to test notifications on Google.

Related

Push notification not being sent from loopback

I have used the loopback sample application "loopback-3.x" given on:https://github.com/strongloop/loopback-example-push. The correct server key was given in config, then created an application and registered a device with that application. Then I tried sending a push notification with "notifyById" method. The console shows a succes message like:
loopback:component:push:provider:gcm Sending message to ["devicetokengiven"]: {"params":{"timeToLive":3600,"data":{"message":"sfwsed","messageFrom":"sdefsdf","badge":2}}}
loopback:component:push:provider:gcm GCM result: {"multicast_id":multicast_id,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:23423555466%24324434354"}]}
It seems to be a success, but the device doesnt get any push notification. What could be the issue? Any help would be appreciated! Thanks!
Unfortunately their last release simply doesn't work with FCM. However, in their last commit they have a change which requires an object with the attributes (messageFrom and alert) and then they convert these att to body and title. Moreover, there is a PR where someone adds another notification's attributes, but I don't think it will be merged soon.
Solutions:
Reference your module to their last commit: "loopback-component-push": "git://github.com/strongloop/loopback-component-push.git#dce16d9be30d80e258c2ac5e3dc1f74276f2b0cd"and send {messageFrom: "your title", alert: "your body"}
or
Use a simple FCM node module or even a HTTP request. Will make your life much easier.

onNotification method not called

I am trying to use Ionic Push for Push Notifications. I have successfully registered with the server and got the Token ID also (Called reg_id in Ionic).
I have followed all the steps as shown in Ionic Docs here http://docs.ionic.io/v1.0/docs/push-install.
But now when I try to send push notifications using the curl command, the notification is shown as sent but is never received by the app. If I check the status, I get the status as success. Please help
Comtroller Code: https://gist.github.com/samarthagarwal/833064a2de0660e826b6
Any suggestions are highly appreciated.

Android PushNotification From Json URL

I have a Json URL, which contains data about Latest Job Postings, I am successfully parsing the Json URL and able to display the top job postings in my ListView.
But my requirement is to create a push notification, so that whenever a new job is posted, the user should be able to get a notification on device.
I have followed this: http://www.vogella.com/articles/AndroidNotifications/article.html
But I don't know how to get notifications in my case.
Could anyone help me?
Issue:
Give push notification to user's device about the updated data even when application is in background mode.
Solution:
Upon successful insertion of new data in your database (which is going to give updated set of data to your JSON request) , just call the file which send GCM push notification to all your users.
Reference:
GCM docs
GCM push-notification using php server
In context of implementation presented in demo app of 2nd link,
upon successful insertion,you can call send_message.php file,but make sure that $regId and $message should be retrieved from your database
You have created ActionBar Notifications for your app, but now you need to create the ability to receive notifications from a web client, instead of going to find them yourself from the URL.
To create a push notification you would need to have a constant thread (BroadcastReceiver) on the device that is waiting for the notification from the sever.
Google 'Cloud to Device Messaging' is the simplest way to do this.
This is a good link with lots of info on how to do this :
http://blog.mediarain.com/2011/03/simple-google-android-c2dm-tutorial-push-notifications-for-android/
If you require these notifications to be displayed on the device even when the application is not running (which seems to be the case from what you describe), you can use Google Cloud Messaging.
You would need a server that would poll the Json URL for updates, and send a GCM message to all the devices where your app is installed once such an update is detected.
Your app would have to register to Google Cloud Messaging and send the Registration ID received from Google to your server.
When your app receive a GCM message, you would create a notification and when the notification is tapped, you would start the activity that loads the data from the JSON URL.

not getting push notification in Android

Please help me since I am stuck !!! I created an app. in my eclipse that gives me the regid for the client side. I created in asp - server side and I am sending a notification to my android. I am getting this message from the server side:
id=0:1369942608307759%5252b7a166d6cf16 but nothing in my phone.... Why ? what do I have to do in order to get notification in my mobile ? It seems that every thingis going fine but for some reason I am not getting the notification...does any one knows what can go wrong ?

GCM android, Push Notifications not being recieved

I am working on an android app that will recieve push notifications from the GCM server.
I am using php as the 3rd-party server.
I've a few questions.
When I send request to gcm server from my php script it gives me the following response
{"multicast_id":8799227316277290616,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1341388064110557%5d17b789f9fd7ecd"}]}
Now the response seems fine but you can see a % sign in the message_id. Is that ok? if it's not than how am I able to recieve the correct message_ID?
When I use json_decode in my php script and echo this multicastid it gives me something like this
8.7992273162773E+18
and I am sure it will give the same type of value when I'll echo message_id also. So why it is not echoing the correct value?
My last question is that when I send this request which seems right and open my android application there is no notification there. Is it caused by the above errors or there is some other problem?
I had a similar issue with C2DM. The reason was that the android app name was not the same for which I requested the quota. It got fixed once the corrected the package name.
In my case, android application was not running so the push notifications can't be received. I started the app and then I could receive messages.

Categories

Resources