Android Question Automatic Notifications

Douglas Farias

Expert
Licensed User
Longtime User
hi i made a automatic system using php and mysql to show me mensages at my app
ok my question is

have a way to make automatics notifications using my db or php time?

for exemple

2 in 2 hours send to all users notifications

i never worked with notifications
what the best way to make this

how lib i can use to make this automatic? *-*
 

nwhitfield

Active Member
Licensed User
Longtime User
You mean you want to send notifications from your server, which is using PHP/MySQL, to all your app users? Are you using the GCM notifications in your app?

If you're wanting to do things server-side, then the simplest way would be to set up a cron job to run every two hours on the server.

There's example code on the forum about how to set up GCM notifications in your app; you have to register it with Google's services to do that. When the app runs, it registers with GCM, and gets an id. It should then pass that ID to your website, which will use it to send notifications - for example, by storing the id in a database and then running through all those IDs in turn, every two hours.

Of course, that pre-supposes you want to send the notification from your web site, and it may be different each time. If you simply want your app to do something every two hours, you could use a service to create the notifications, and call StartServiceAt to schedule a new invocation in two hours time.
 
Upvote 0
Top