Remote Service Controller and Android Apidemo with local Service sample resolution: App->service->local Service Controller
Is the "started" mode of using the service, and the definition of Remoteservice in Androidmanifest.xml is as follows:
<service android:name= ". App. Remoteservice "android:process=": Remote ">
<intent-filter>
<!–these are the interfaces supported by the service, which
can bind to. –>
<action android:name= "Com.example.android.apis.app.IRemoteService"/>
<action android:name= "Com.example.android.apis.app.ISecondary"/>
<!–this is a action code can use to select the service
Without explicitly supplying the implementation class. –>
<action android:name= "Com.example.android.apis.app.REMOTE_SERVICE"/>
</intent-filter>
</service>
The code to start and stop the service in Remoteservice.controller is much simpler than the "Bound" service mode:
Make sure the service is started. It would continue running
//until someone calls StopService ().
We use a action code here, instead of explictly supplying
//The component name, so and other packages can Replac e
//the service.
StartService (New Intent (
"Com.example.android.apis.app.REMOTE_SERVICE"));
... ...
Cancel a previous call to StartService (). Note that the
//service won't actually stop at this point if there are
//still bound clients.
StopService (New Intent (
"Com.example.android.apis.app.REMOTE_SERVICE"));
The "started" service runs after it is started until StopService is invoked. So after you press Start service, after running the Android Apidemo sample resolution: App->service->remote Service Binding to bind this remoteservice, Since Remoteservice has started, you will find that the initial value of the received from service in example 42 is generally not 1.