Look at the LocalService example.
Your Service
returns an instance of itself to consumers who call onBind
. Then you can directly interact with the service, e.g. registering your own listener interface with the service, so that you can get callbacks.
More Related Contents:
- Start Activity from Service in Android
- How to have Android Service communicate with Activity
- getApplication() vs. getApplicationContext()
- Communication between Activity and Service
- Launch Android application without main Activity and start Service on launching application
- how to send string from one activity to another without starting second activity [duplicate]
- How to send an object from one Android Activity to another using Intents?
- Android: How can I get the current foreground activity (from a service)?
- Android 8.0: java.lang.IllegalStateException: Not allowed to start service Intent
- Using Intent in an Android application to show another activity
- How can I return to a parent activity correctly?
- Passing arraylist of objects between activities
- How to get the current location latitude and longitude in android
- Difference between Service, Async Task & Thread?
- Notification to restore a task rather than a specific activity?
- Notification click: activity already open
- Broadcast Receiver within a Service
- Stopping & starting music on incoming calls
- Android – startActivityForResult immediately triggering onActivityResult
- How can I add an animation to the activity finish()
- Android: Capturing the return of an activity
- How to correctly start activity from PostExecute in Android?
- Don’t keep activities – What is it for?
- Determining if an Activity exists on the current device?
- How to replace a Fragment on button click of that fragment?
- Activity.finish() called but activity stays loaded in memory
- Android 4.4.2 – java.lang.RuntimeException: Performing stop of activity that is not resumed
- onActivityResult With launchMode=”singleTask”?
- Move an Image in circular path in android
- Simulate killing of activity in emulator