0

I have an android app which receive data from web service and insert it to android's local database. This data flow is begun with a button in app's admin panel. I mean, an author login to admin panel in device and click the "Start Sync" button and device's database start to sync with SqlServer database.

I want to do is trigger this event from remote server. In other words, I want this process to begin as if someone clicks the "Start Sync" button, when I click the button in an web application. Let this web application is server and the devices are clients. I want this process to be triggered for all clients (broadcast).

How can I achieve this ? Thanks.

2 Answers 2

3

Have the clients (app) register to your server as GCM clients. The server can then send a request to all registered clients to update. In your app, you will receive an intent. Here's how to get started.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for your quick reply. I had already made a research about it. Is it for only send messages to clients ? So I dont need to send message or notification. I want to fire the event in client. Can GCM do that ? You mean server should send a specific message and client should start sync if server send the message (with a basic if statement) ?
Correct. GCM provides the mechanism and transport. You no longer have to worry about whether a client has access, is turned on, etc. You just send a message -- the message would then tell the client to do the sync, or it could do anything else.
2

Just a hint.

I also once wanted to implement a similar strategy to force updates on clients. In the end I switched to the app and user deciding when to download the data. (on startup and an alarmmanager which controlled a non persistent Service for daily updates).

A lot of developers forget the users, I've seen many applications with persistent services, and more undesirable behavior. Just because you can control users or program easy.

Otherwise Google Cloud Messaging is the way to go, as 323go mentioned

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.