-2

The idea is, teachers just send any message in the app and hit send. I want it to save into database using PHP. After that, whenever the students are connected with network, I want to make it automatically get the message sent by teachers and notify the students through notification bar.

I think it is possible but I don't know what is the correct term to google the tutorial. Any suggestion? I just want to make it simple. Teachers only send message and students only get message. Nothing much.

August
  • 309
  • 1
  • 5
  • 15

1 Answers1

3

You could create a php script on your server to both save teacher's messages into the database and another php script to retrieve all the messages.

Then in your Android app, you could send HTTP POSTs to call your php script in your server and save the messages and HTTP GETs to retrieve those messages, whenever a certain button is pressed. This can be done using Http Client library from Apache Commons.

Bruno Lopes
  • 181
  • 5
  • what about notify students when there's a new message? – August Nov 14 '15 at 04:23
  • 3
    If you need to save mobile data and near real-time notifications, then Google Cloud Messaging is what you're looking for. Otherwise, you would have to send a HTTP Request every X minutes looking for updates, which would consume more resources. – Bruno Lopes Nov 14 '15 at 04:32
  • what if I use refresh button to get it? is it still consume more resources? – August Nov 14 '15 at 04:55
  • It is a good idea, certainly would consume less resources. If it's not a problem for your project, you could go with that. – Bruno Lopes Nov 14 '15 at 04:57