java - Android two-way service communication -


i have activity , local bound service. i've got bound service , running fine, can handle communication client server, through functions on server/binder interface.

however need 2 way communication, service @ point need notify activity (and user) happened, , needs wait user action before proceeding. in other words, need servers calls clients synchronous or blocking. i.e. when service calls function pass few parameters on client, trigger alertdialog user use, , options determine return status code sent service. until point, want service halt , wait until has recieved response, determine there (service continues run, service shuts down etc.)

so there way in android this? need reference activity, , needs expose these blocking methods can call them service , wait response. i've got interface client activity, i'm struggling on how on service. don't want use serialization , add reference intent extra, both client , service have many members not want serializable.

thanks.

  1. you can use broadcasts send info service activity.
  2. every call of startservice() inside activity class call onstartcommand() method of service class, can send message inside intent.
  3. use service binding make own info transfer.

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -