Вопрос

I using pubnub chat for android using titanium appcelerator platform, I had just crossed about the push notification to android via pubnub , It provides its own development kit for the chat clients but i tried to use it for android, I couldn't there is existing sample for ios but not for android actually. Anybody had crossed this issue...let me know how to use this.

Pub nub help link for push notification....

Это было полезно?

Решение 2

Actually it is pretty simple as i thought to create a pubnub notification. We have to simply run background service and in that do the following steps.,

  • Add background service using this BOOT_COMPLETED Titanium module ,
  • Before suscribe a new channel inside the background service code. (for eg.: MY_notify_channel),
  • Next go to your chat screen , Next to the line that you are publishing to your private dynamic channel, Publish once again to our MY_notify_channel .

  • That's it when ever you publishing you get a message received in your service box, you have segregate your message in that and then create a notification manually. Titanium.Android.Notification link

Другие советы

When using PubNub in an Android app (Phonegap or Native), you do not need to use GCM because you can implement a subscribe at boot service that forwards incoming messages to the background app using Intents. See this example for more details: https://help.pubnub.com/entries/21720011­Can­my­Android­App­Receive­Messages­While­Inactive

That KB article has a link (hard to see in the article) that will lead you to the Subcrib-at-Boot example in the PubNub Andriod github repo here: https://github.com/pubnub/java/tree/master/android/examples/SubscribeAtBoot­

Android with Phonegap You need to implement a Phonegap JavaScript/Java bridge which has a bit of work that can be implemented by following our Android Subscribe­-at ­Boot (above) service solution and piece it together. http://www.tipsfromsiliconvalley.com/2013/07/06/create­a­service­on­android­with­phonegap­ap plication/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top