PHP and Android GCM push notification - How to store users - php

I have my Android client application that wait for a push message from the GCM Google server... on the server side, my web must store the registration ID of the device, in order to send the push notification to this specific device (calling the GCM Service with a specific PHP class).
The question is, how can I refresh the registration Id of the device every time It is registreted on the Google GCM servers? How can I associate to each users on the web app to a specific registration Id of the android app?

You can use PHpmyadmin tool to creat the data base and use the php script to open,store registration Id and close the db.

Related

what is the proper way to save a firebase push notifications sent

I'm using firebase push notifications php api with android...
When I send a notification from firebase API, to android device, I also make a MySQL input, to register one copy of that, and work!
but...
What happen when the API sends too many push notifications?
There is no problem with my shared server?
I'm worried that my server will collapse for too many records for each push.
Right now It work like this...
Firebase API PHP send notification -> MySQL register that notification in one table -> Android Device recieve the notification.
but I don't think this is the right way...
so... the question is...
what is the proper way to save a firebase push notifications sent...?

Notification from web site (HTML Table) to Android application in real time without using GCM

I am developing an android application and website as well, in this i want to send notification in real time from Admin panel to specific android application user. The main problem is that using GCM (Firebase CM) there is a token generated from android application and stored it in the database, using this token we can send message from admin panel to android application user. Is there is way that we can receive/send notification without using "token" because e.g. "Teacher send notification to students from Website to Student android application teacher just select the registration name or section and just type what he want to send and click send button. Notification should receive to that particular user.
How we can do it? Can any body help me?
Use Android service and call API as a background and check new entry in notification table, if found new entry display it as a notification
Without Device Token you can not send any notification from Admin Panel to Android App. To send notification FCM needs a unique ID that is Device Token.
To resolve your query:
You can use Alarm Manager or a Background Service that will call your API to check have any new message of teacher in your DB, if have any new message then generate a notification with that message.
Only Background Service is not a complete solution, it will only call your check new message API.
Your Alarm Manager that will trigger at any given time duration e.g. 30 sec and call your Background service.
That can help you without token.

How to trigger Remote push notification using php when firebase data changed

Goal :- Detect database changes of firebase.
I am using firebase PHP CLIENT.
With using firebase php client i am able to
Connect to firebase node
Add / update and delete nodes.
List number of nodes.
Above functionality works perfectly.
But i want to achive functionlity of push notification when user goes offline in to the group as well as person to person chat.
Firebase database is real-time database so, how can i detect the changes of firebase database nodes so i can keep on watch on the message node changes and i should fire my push notification API from php.
The main functionality i want to achive is sending push notifications to group and person to person using firebase chat to mobile platform ( Ios and android ) .
Is there any alternatives avaialable for the same? OR any plugin which will does the same job?
Or in the another way is there any posibility to send push notifications using mobile end ( web independent ) ?
Any help would be appriciated.
Thanks in advance.

Can I generate registration token for GCM using my app server?

I have a list of Device Id's with me but the regID column of the table got deleted. Is there a way I can send push notifications via GCM with just Device ids?
App is registered on GCM with those Device IDs, only the regID got deleted. The app server I am using is in PHP.
Can I generate registration token for GCM using my app server?
Unfortunately, there is no way to generate, re-generate or refresh registration tokens from an App Server. All of these processes are done on the client app's side.
Is there a way I can send push notifications via GCM with just Device IDs?
Nope. The registration token is the value needed by GCM (or even FCM). You'll have to retrieve the tokens from the client apps somehow and save them (again) accordingly. Having some backups of these tokens would be great.
In general there is no. For send notification you must have a regID what was created on device.

What are the cases where a registration ID of GCM changes?

I am developing a web push notification system using Google Cloud Messaging (only web). I am using a GCM registration id to send the push notification in an Android device.
Can anybody tell me if there are any cases or scenarios that the GCM registration id will be changed for a device?
FYI, I would like to share my current knowledge:
The GCM registration id will be changed if the application is updated or re-installed.
If the device OS is updated.
My system design is as follows:
First, I register the registration id of the device in my database ?
(This is the only one time my client access my site and be able to get the registration ID and where I save it).
Then, I send a notification after a month or later (it depends, maybe even after 3 months).
Here are my questions:
If the device OS was updated in during that duration, does the device id change?
If the Chrome browser is updated or reinstalled, does the device registration id change?
If the registration id does change (because of one of the reasons above), how can I send a push notification to the desired device?
Appreciate the help. Thanks in advance.

Categories