Android trying to get my app to talk to a local service -


i have created service locally , wondering if there way call methods. thinking using stream sockets , have client send messages service, seems work. code have create service

public class welcome extends activity implements onclicklistener{     private static final int notify_me_id=1337;     private timer timer=new timer();     private int count=0;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);           // set buttons         view mappoitment = findviewbyid(r.id.appoitment);         mappoitment.setonclicklistener(this);      // start background thread         log.v("ted:", "starting thread");         startservice(new intent(welcome.this,                 backgroundservice.class)); 

ted

you might want consider exposing aidl interface service. more details , example refer documentation here: http://developer.android.com/guide/developing/tools/aidl.html

another option have service register broadcast receiver , sent intents it.


Comments