Questions tagged [android-service-binding]

In Android applications, a bound service is an implementation of the Service class that allows other applications to bind to it and interact with it. Service binding is used to allow services to be consumed from other components.

In Android applications, a bound service is an implementation of the Service class that allows other applications to bind to it and interact with it. Service binding is used to allow services to be consumed from other components.

More Info

420 questions
3
votes
1 answer

Android Service and its engine

I have one doubt about using services. I have a service that initializes an object, is it a bad practice to pass an instance of the service to the object so it can be used for that object? A simplified object would be: public class MyService extends…
FVod
  • 2,245
  • 5
  • 25
  • 52
3
votes
1 answer

Android Service Closes After Unbind

I have a Service that needs to get some input from an activity. In order for them to communicate I bind the activity to my service and communication works great. However, once the activity is closed and unbound from the service, the service stops…
Bone
  • 91
  • 8
3
votes
1 answer

Android service with u10_system user id

This is under Android Kitkat/Lollipop with multiple account feature enabled. I created a service with the user id "system", and had an activity binding to the service. Then in different user account, I tried to have another activity binding to the…
JustWonder
  • 2,373
  • 3
  • 25
  • 36
3
votes
2 answers

Doubts about bindService

I have some boubts about Android bound service. The guide: http://developer.android.com/guide/components/bound-services.html ,about bindService(), says: The `bindService()` method returns immediately without a value But this does not seems to be…
GVillani82
  • 17,196
  • 30
  • 105
  • 172
3
votes
1 answer

Android Activity Service Communication

I am implementing a android software which has a service and a activity.And I do some code according to the youtube video. But when i click the start button,Run button they work fine. But after I restart the service (by press stop and then press…
3
votes
2 answers

What is the proper way to handle remote server disconnection?

Almost all examples of work with remote services contain such code (this one was taken from Google IabHelper) mServiceConn = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { …
3
votes
2 answers

Android iBeacon library usage outside activity

I am trying to use the iBeacon library outside an activity context, to write its effective implementation but i am missing something as i am not getting the desired functionality. It most likely seems that the service is not bound to my newly…
3
votes
1 answer

Android: bindService always returning false (Expansion APK api)

I'm trying to use the APK Expansion extension from Google to download expansion files I have hosted with them. I'm also using the code from the SampleDownloadActivity to do this, albeit slightly modified to fit in my app. My problem is that the…
2
votes
1 answer

What happens when i call stopSelf in onDestroy method?

I have such a method implementation and I want to understand what will happen when this method is called. Could you give me a hint override fun onDestroy() { Timber.d("$this: onDestroy") stopSelf() super.onDestroy() }
2
votes
0 answers

Can a bound service start itself?

I have a service that is designed to run in the foreground and allow clients to bind to it. It is similar to a music foreground service (described here) that plays music and allows an app to bind to it and control actions like pause and…
2
votes
0 answers

Jetpack datastore not synchronised data between activity and service

Android application consist from visual part(activity) and bound service. Visual part is used to configure Service. Config is stored in Jetpack DataStore. Service read config on every client connection(in onBind). When new config saved from…
2
votes
0 answers

FirebaseMessagingService immediately destroyed after being created

I am using a BroadcastReceiver to send a broadcast to restart the FirebaseMessagingService when the service is destroyed. However, when starting service this way, the FirebaseMessagingService gets immediately destroyed. When the service is…
2
votes
3 answers

Should I use a workmanager for an immediate work without showing notification

Let's say my application has several activities. When I come to the first activity, I will initiate an api call. User won't be blocked during this api call and can navigate to other activities during this time.The status of this api call can be…
2
votes
1 answer

Service freezing activity before UI has inflated

I have a long-running service that is bound to a loading screen. I know this is suboptimal, but an AsyncTask did not work for me as it keeps running (data leaks) even after the Activity is ended forcefully. Regardless, want to understand what is…
2
votes
1 answer

Android communicating from Service to Clients

I'd like to keep a reference to each client that binds to a started & bound Android service. My service is NOT in a separate process. I can have multiple clients bound, e.g. - 1 Activity and 2 Fragments. They may all be interested in a combination…