Zohaib
Zohaib

Reputation: 2865

Get Notification in android when there is any update in MySQL

I want to implement Notifications based on changing in MySQL. i have an app thats send tasks to device on runtime. I want that i get notification on my android device when i insert a task in Task table in MySQL. I can get every task from MySQL using php. and i have also make login in which i get username and password and verify it from MySQL. and same like that i have did for task. to get tasks. like this and now i am following this tutorial for implement notification. but how can i get notification when inserting task in MySQL. i have to make an service that will run in background but how will i get if there is anychange in task table. ?

Upvotes: 5

Views: 9029

Answers (3)

1615903
1615903

Reputation: 34732

You should take a look at Firebase Cloud Messaging, it provides functionality to send messages to the device without polling.

Upvotes: 3

Volodymyr Smotesko
Volodymyr Smotesko

Reputation: 438

You can use MySQL triggers to catch changes. In the trigger code you'll do INSERT INTO changes_log … and you can watch the changes_log table for new records.

Upvotes: 0

m4t1t0
m4t1t0

Reputation: 5721

You can create a trigger in your MySQL database and run an external application everytime a row is inserted in that table. More info: http://dev.mysql.com/doc/refman/5.1/en/faqs-triggers.html#qandaitem-B-5-1-10

Upvotes: 3

Related Questions