Android Change a variable in service from other app -


the title says all, need change variable of service activity in other app , finalize service or not, possible?

i found message object , not quite understand

the simplest solution implement broadcastreceiver. service listens broadcast , other app sends broadcast.

example reciever:

public class myreceiver extends broadcastreceiver {   @override   public void onreceive(context context, intent intent) {     // bundle intent , use set variable in service   } }  

example broadcaster (courtesy of vogella):

intent intent = new intent(); intent.setaction("de.vogella.android.mybroadcast"); sendbroadcast(intent);  

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -