Push Notifications using GCM - android

I have Python2.7 and installed this modules: feedparser, Kivy, plyer and setuptools-17.0.
I am developing a simple Android app with a web-viewer inside and the core functionality is that I parse a simple XML and whenever a new feed is posted I want the user to receive a push-notification on his Android Device.
I have my own web-server and also I've tried different push services on the web, but they are trials or very limited. Can someone please give me guidance on how to manage the push-service? Maybe a couple of hints on which modules I need to get my job done.

You will need to create a couple of services that interact with Google's GCM
You will need a callable URL that can process the registrations of the device when the app is first started.
You also need to send a JSON file with the data to be sent when you have a new notification to be sent.
All of this is fairly straightforward in Python.
You can get more information here.
https://developers.google.com/cloud-messaging/
You will need a Google account to setup GCM

Related

How to Integrate FCM with Ejabberd?

Environment:
Ejabberd Version : 16.04
Smack-android-4.1.0
I have created an Android chat application with a XMPP server. However due to Google play permission issue I had to narrow down the feature from app which supported receiving incoming message notifications when the app is in the background.
As an alternative I received the following suggestion from GooglePlay Review Team.
Once you’ve removed this permission, you might consider using Firebase
Cloud Messaging (FCM) if your app’s message delivery requires a
temporary exemption from battery optimization. Please set high
priority only if the message is time-critical and requires the user’s
immediate interaction, and be aware that setting your messages to high
priority contributes to more battery drain compared to normal priority
messages
So at the moment users can send messags via the app. But when he close the app, he will be considered as an offline user, and will not receive any notifications from app. When he opens the app again, he will get all the offline messages those were saved the Ejabberd server.
I want to enhance the current app so that even though a user had closed the app he will still receive a notification when some one sends a message to him (Similar to whatsapp)
Is there a module in ejabberd which integrates the server with FCM and handles this?
If we can not achieve this by Ejabberd, is there a 3rd party library to support this?
If not do we have to write an Erlang module from scratch?
I found similar questions in the internet but I could not find any working solution. Since I am not much experienced with Erlang and would be glad to hear your solutions/ideas on this. Thanks in advance.
This can be achieved in Ejabberd with offline_message_hook. This hook is trigger when sending a message to the receiver and receiver in an offline state. So create a custom module using this hook and you can send a push notification to FCM and APNs servers.
Refer this blog -- https://jasonrowe.com/2011/12/30/ejabberd-offline-messages/
Looks like you need to try apply approach below:
Create REST API for store of user tokens with JID's of users
Create custom hook for fetch XML packages.
Integrate into project the epns library(this library can send FCM/APNS)
In custom hook call the spawn function where will be get the user token from DB by JID and creating payload with sending FCM/APNS notification

Push Notification from website to mobile app

I want to develop a website that will be able to send push notifications to a mobile application that would be able to run on both android and iOS.
For the last couple of years, I am working as a web developer so developing the website is not something that I am worried about, but I have never developed a mobile application before, the mobile app would only receive notifications from the website so the main functionality would be in the website.
Can anyone suggest me what the best approach is and what I have to learn to be able to do this?
Thank you in Regards
I guess, you have 2 options.
You can either use Firebase FCM
https://firebase.google.com/docs/cloud-messaging/
or use a third party which is called OneSignal
https://onesignal.com/.
If you are looking for an easier way then I recommend using OneSignal instead. You just need to define API Key in your build.gradle and initialize OneSignal in onCreate().
The best approach, in my opinion, would be to use firebase (https://firebase.google.com/products/cloud-messaging/). I think it is better because it is a unique framework for both ios and android and you don't need to worry about the user device when sending the message(you could build an interface in your backend code to handle this but why doing something that already exists and it is free).
The flow is something like this:
on the first start the app(either ios or android) must send its firebase ID to your server so that you can store it (simple http request will od it) and set up a listener for the incoming push messages
when you need to send a push message all you need to do is an http request and you can trigger it with js from your website. The request will contain data such as the firebase id of the receiving device(which you have previously stored)
Firebase Cloud Messaging also have some really nice features like upstream messages(push messages from the device to the server, but you need an xmpp server to listen for them) and topics to send the same notification to many users at the same time
I think the best approach would be to create a node server where the website would be running on and then use Firebase Cloud Messaging (FCM) to send notifications
EDIT: FCM supports both Android and iOS

NodeJS to android app communication

I'm making a NodeJS server and an Android app that goes with it. I need to send alerts to my mobile app users that's coming from the web server. Something like a a chat app on the server and the android users getting the messages also (Facebook messenger?).
I have the server ready and Android app communicating to its database (for user login/getting user info/etc) using REST. I just need to figure out how to send info to the Android app WITH THE SERVER INITIATING COMMUNICATION. Any advice on where to start?
Start by looking at Google Cloud Messaging.
It's a free service that accepts messages from your server-based program and queues it to be sent to phones with your app when the phones are online.
Here is the overview on Android Developers.
YES!
Working with NodeJS, you have probably already heard of Socket.IO.
I'd say: Start there!
For your app to communicate with the server, there's also the java lib. These are great tools to start making any good real time service.
After you get along with this, you should also check GCM as #krisLarson suggested. And talkign about GCM, you have Node-GCM to make your work even easier.
Good luck!

How to send automated Push notification using Pushwoosh in android

I have asked this question before but no answer. I successfully integrated Pushwoosh into my android application and their service has been wonderful, but now I want to make it automated because in one of the section in my app, there is a blog that is constantly updated using a Json Webservice. What I want to achieve is this, I want a push notification sent to users on the app, when there is an update from the Json web-service. Is there an online tutorial on this and how to achieve this, I would prefer if its very explanatory. I have searched online for a while now and i have been unable to come up with anything meaningful.
I learnt from Pushwoosh pricing site that we need to pay minimum 39Euros for subscription and only then we get access for RemoteAPI with which we can push data from our server. This facility is not available for free version. In case you have implemented this, kindly share some steps for the same

PushNotifications - How to Implement

I am a newbie in android. I have developed few applications, but all are plain and simple, just used the built in features of android.
I was asked about push notifications, in one of my interviews and I decided to have a look at what Push Notifications are. I understand the concept of Push Notifications(I think), but whenever I read the term "Server", it's freaking me out.
I understand all the client side coding, but I don't get how to implement the server side coding. I have seen some people use XMPP, MQTT, etc., What are those? Here is my scenario and what I want to know..
Scenario ::: Let's say I have a website, with a table (the values are retrieved from database), where I update a few columns every day. I want these updates to be reflected in my android application. So, as I have read, push notifications can tell the application that there are updates available. Good. I am fine till here..
When the application gets the notification, should my application, contact the website and get the latest information? or will the updated information sent through Push Notification? I guess, my application would be contacting the website and get the information. Now, how do I get the data from the website? Should I get the source of the page and do some kind of parsing or something?
I will be asking more questions, as the experts clear my questions...
Sorry, if my questions are too naive, but this is the only place that can help me...
Push Notifications means Google Cloud Messaging for Android (GCM) is a service that allows you to send data from your server to your users' Android-powered device.
You can refer to this documentation
Google Cloud Messaging for Android
GCM: Getting Started
And there is also Demo App Tutorial given
in your case you need to create HTTP web service for getting data from the server.so when you get notification about update on server side.you just need to call this web service and get the data you need to update

Categories

Resources