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....
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/21720011CanmyAndroidAppReceiveMessagesWhileInactive
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/createaserviceonandroidwithphonegapap plication/
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
Related
I am building my first Android app and need to know how I could use push notification.
My project is a home alarm system and also I have built my own local web server. Now I want to push a notification from my server to my Android app when an alarm appears in my server.
Currently my garage doors use the MyQ app and when the garage door opens or closes I get a notification on my phone, I want to implement the same thing in my app.
I've been reading about the Google Firebase Cloud Messaging but it seems exceeding my need.
If you need push notification on your cell phone then you definitely need to integrate your app with Google Firebase. (or at least that's the right way of doing it).
Alternatively, there is something called as local notifications & background process in Android you could do long polling to check if the garage door is open (probably every 2 mins or something). However, I don't recommend that as it can drain your mobile battery.
Also I recommend using Flutter as oppose to using Native Android. As there are some pre-built libraries for android and Google Firebase integration.
Take a look at this Youtube video - https://www.youtube.com/watch?v=2TSm2YGBT1s
Ouh, maybe thats a little bit too much for starting with android - nevertheless I want to help you.
You need a communication protocol between your server and your phone (i.e. Firebase as you mentioned or Websockets).
If your server sends a message to you client (your phone) you have to create a notification. (Android Developer Guide). That's the theoretical part. You will also stumble across a lot of
challenges with
asynchronous programming.
Firebase might actually be the simplest option. You could build your own web socket service too, but that would probably be more than you need. See this previous question for more options: Android push notification without firebase
Android has some services that communicate with firebase to receive notifications.
You'll need to implement a service on top of your web server (using backend languages such as Python, Node.js, PHP,...) so it can send notifications when an event happened (like the door closed) witch isn't a simple way for a beginner.
then your web server sends a message to firebase and tells it to send a notification to my client.
so I highly recommend using firebase because of the simplicity of usage. otherwise, you should implement a separate service on your android phone to get the notification (if you want to run it locally) also as explained do the backend side.
I know this seems like a basic question, but I can't find a clear answer to it. I want to develop an Android app with Xamarin to receive push notifications (new messages) from a Gmail account. I know the native Gmail app already does this, but for a few reasons I need to implement this funcionality myself. I searched about GCM, FCM, but I haven't found a single guide or example on how to do this. Please help!
I think the challenging bit here is the Gmail part.
For your scenario to work:
Gmail will need to forward its changes to a server-side application that you control
This server-side application will need to create a push notification by sending it to GCM/FCM's web services
From here you will need to implement push notifications normally in a Xamarin.Android app
I don't think you are going to find a prebuilt/off-shelf solution that achieves this.
This is a pretty tall order to implement yourself, but it seems to be quite possible. I will walk through what I would do to make this work:
Implement an Azure Function to act as a webhook for Gmail. Docs for Gmail here. I don't know if there is an example for this part.
Use Azure Notification Hubs to send push notifications. Your webhook will forward notifications to the hub. I have a sample here of sending from an Azure function.
Integrate the Azure Notification Hub SDK into your Xamarin.Android app
Like I said, this is quite a bit of work. I'm not sure if you have Windows Azure or Xamarin experience, but I think this is the easiest path forward for a new project using C#.
I have a book here (make sure you get 3rd edition) that covers push notifications and Azure functions in Xamarin apps. The sample code for the book is on Github if you want a free resource.
Take a look at Zappier, it integrates well with OneSignal which sends notification on top of Firebase. setup is easier than you can imagine.
I wanted to achieve a quite similar application to what you wanted to achieve. In my case, I wanted to develop a xamarin app that fetches a specific user's tweet and pop a notification to android client automatically.
Zappier provided easy integration between twitter and onesignal.
Onesignal automated the messaging.
Take a look at here for pre provided integrations:
https://documentation.onesignal.com/docs/zapier
I have developed web based application using yii2 framework and MySQL database and my plan is i want to make an android app that can receive notification from my web based application real time and can pull data from it too. but i'm not sure how can make it works and using which methods i can implement this. can you give me some advise and source to learn it?
thanks
You have to follow below steps to implement push notification
1) You have to register on google developer consol
https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passive=true&continue=https://console.developers.google.com/dcredirect/
2)enable the GCM api from api list that available in api lists further instruction you will get on site when you create account.
3)Generate key for GCM web/ android.
4) Use this GCM key from android app and write the the GCM notification receiver
program in android app and using notification manager show on notification bar.
5)Using server side key you can write the program to push notification from web site.
I was searching for an API like EasyAPNS for Android. EasyAPNS allows to add PUSH Notifications in iOS with minimum codeing required and all tested stuff to reduce development time. I was interested to find similar thing for Android too so I may not need to write the whole backend and service stuff for Android. Have you come across any API so far?
I know how notifications in Android works and how can a service be used to generate notifications. The service in Android must listen for remote requests and as they may arrive, it will add to the notification tray.
Well, Minimoesfuerzo did a plugin that integrates UrbanAirship and PhoneGap Android. That may provide you the functionality you need:
http://minimoesfuerzo.org/2011/06/3/urban-airship-integration-android-phonegap-app/
I want to implement push notifications on my application. I want to push directly from my servers, and thus cant use Google's C2DM or Xtify..
I learnt about the deacon project, but facing problems using it.
Firstly, my complete project is in Windows, and the Meteor server runs only in linux.. is there any work around?