Push Notifications in Android for particular user - android

I am having an app developed and in that its for the restaurant manager so i want to add the push notification to the manager on receiving the order. so how is it possible.? i want to notify that particular manager only who has received an order on the web. I want to develop that as soon as the website receives an order for particular restaurant the notifications should be sent to the restaurant manager about that order. how is it possible?

For implementing you need Server +GCM+ web services
First user will be logged in the app through Facebook, Gmail or custom authentication.
Parameter(email or password also device id of android Phone) will go to the server through web services(by rest soap etc) and saved on database.
The logic of the code will be
If any user select food sent a request to server and server will sent it to the restaurant manager's device
for more information
please refer http://developer.android.com/google/gcm/index.html & http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

Related

How to send push notification to specific devices

I got two mobile apps for service provider and customer, i need to send push notifications for service provider user once the customer requests a specific service type. So it needs to be filtered and send only for those who can provide such a service. Therefore web api needs to send the notification only for specific users, how can i do that with firebase should i use, device mac or registration id generated by firebase.
Any help
register a new project in FCM console.
Make android/ios and web(for configuration) application.
The first-time app will be loaded it gives device token and store to the database.
by using device token you can send a notification to a particular device.
Reference link:- https://www.djamware.com/post/5c6ccd1f80aca754f7a9d1ec/push-notification-using-ionic-4-and-firebase-cloud-messaging
First you have to get the fire base token from android app.
Register your mobile app in Firebase console.
If you have any user login api and database, send the fire base token while user
login your app and save the token against the user.
Whenever the user request for service you can get the token of the particular user
and send a message to fire base api with that token from server side.
It will automatically send the message to that particular device whoever login your
app.
Make sure you update the token while if other user login your app in same device.

GCM between User to User from same Android App

I would like to implement GCM in my Android app:
One Android app
Registered- U_user and another M_user.
I have Google Sign In in my app thats works fine with JSON and GSON and local MySQL database server with tomcat-server restutil to keep storing Gmail login users.
So, I want to send a notification from U_user to M_user.
U_user does a registration that has been pushed to M_user.
How can I do this?
I am assuming you mean the same Android app installed on different phones (U_user's phone and a separate phone for M_user).
To quote a section in the docs:
To make sure that messages go to the intended user:
Your app server can maintain a mapping between the current user and the registration ID.
The app can then check to ensure that messages it receives match the logged in user.
What this means is that you can send messages to another user through GCM. To let the app server know what to send to M_user, let U_user send an upstream message to your GCM app server (only possible in app servers using XMPP - see here). Alternatively, you have the option to do POST requests to your app server via HttpUrlConnection (can work on both XMPP- and HTTP-based GCM app servers).
Regardless of which method you use, specify in these messages to the server that you would like to send a message to M_user.

Sending push notifications to a list of friends in an Android Native App

I am creating a native Android application that sends push notifications to a specific list of friends. How to send push notifications just to this specific list in Android ?
Actually Push Notification mainly sends from server, from application side you must need to create one Browser Key on Google Api Console, after creating your app there and need to activate GCM from there.
Then, you need to give GCM Registration Id to your server and then whatever push you want to fires, server triggered one query with it and will send push to all your friends list.
Take a look the Urbanairship, it provides send the notification by registered tag/id, and also provide broadcast notification.

Android Authentication and GCM Push notifications

I'm looking to create for my app some authentication. This will basically consist of a user registering (preferably with their google account, although not necessary) and providing a username that is then sent to my server and then having the ability to log in. I then from there would like to be able for the client app to communicate with my server by sending data and receiving push notifications via GCM (google cloud messaging). It is important that the server is able to send a push notification directly to a certain user not to all registered devices.
Would someone be able to point me in the right direction for what I must do? I've had a look at a few tutorials but what I've seen has always sent messages to all registered devices not to a specific user.
Some extra information about the app:
-The client app (user) will need to send a piece of information to the server. This information will also include the user that it needs to be sent to. Once the server receives the piece of information it should send a push notification through GCM to the specified user's client app.
I'm clueless as to how I need to go about setting up the authentication system, any help would be very appreciated!
Thank you very much,
Daniel
Offcourse you can send push notifications to selected users. This process would roughly comprise the following steps:
1) send the User's GCM registration id to your own server along with a unique user id (what ever id you have assigned to that user; could be email or sim id or something like that). Save it in your database.
2) To send Push notifications to selected users, choose users from the database based on some criteria, retrieve their GCM registration ids from the database and forward them the GCM server.
but there is one important thing you must handle. GCM registration ids could change e.g if user uninstalls and re-installs the application. You must update you corresponding database entry in that case.

Using GCM for device to device app data sync

I am planning to build a shopping list application, wherein grocery items from one user (tied to one google account on the smartphone) can be sent over to another app user (tied to another google account on his/her smartphone).
Seeing GCM, I am not sure, if we can do a device to device kind of data sync? Any ideas on how this sort of stuff is basically implemented in a quick and easy way would be highly appreciated.
you dont necessarily need to use GCM or any messaging service, all gcm is meant to do is notify a device that something has changed on your server and that you need to go get all the new stuff.
that being said all you need to do is just have a sync button that the user can manually sync the list from the server to the device and vice versa which would get rid of the need for GCM.
if you wanted automatic syncing then GCM or any other messaging service would be what you want
To elaborate on tyczj's answer, you will need a server anyway to store GCM registration ids from your users. So you can use the same server to host groceries items for them.
So the flow will be like this:
User A wish to send groceries list to User B, he uploads groceries list via your server's Web Service API, along with User B's google email address.
Your server has a list of GCM registration ids, which will be associated with their google email address. The server finds the GCM regid of user B, and push a notification with a URL to download the groceries list to him.
User B's phone receives GCM message, display a notification to let the user download the groceries list from the URL in the GCM message.
GCM is only needed if you want this 'real-time' way of syncing the list. You could also omit GCM, in which case, User B will only know User A has shared the list with him, when he runs the app (i.e. every time app is run, it will perform 'is there someone sharing a list with me' command).

Categories

Resources