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
0
votes
1 answer

Notification with custom text and icon not showing when starting with a service

SO, I have a MainActivity that has a button which starts a service, MyService. I want the service to show the notification with a custom title,text,icon,etc. The service is a foreground service. not a bound service. everything works fine but the…
0
votes
1 answer

How to get my device bluetooth id.i try to get but they all time return 02:00:00:00:00:00

Hello I try to get my Bluetooth device id but that's not working. i try below code so can you check which mistake is i made in that. public static String getBluetoothMacAddress(Context context) { BluetoothAdapter bluetoothAdapter =…
0
votes
1 answer

Service Binder object casting issue during service connection

I have an issue in service connection issue in that line var binder:TwentyFourHoursService.LocalBinder = service as TwentyFourHoursService.LocalBinder and could not find solution: override fun onServiceConnected( className:…
0
votes
0 answers

How to bind a service to multiple activities without it being stopped while navigating between activities?

I was wondering, in Android, I have a service that holds a timer since connecting to a BLE device. I would like the service to stay bound until either the device disconnects or until the entire app is closed. I do not want the service to be…
Pink Jazz
  • 784
  • 4
  • 13
  • 34
0
votes
1 answer

Can I expect my application's constructor to get executed completely before my service methods are invoked?

Coming straight to question, App_A -> binds with service in App_B App_B tries to init few values in it's application class constructor Can I expect App_B's Application class constructor to get executed completely before the service methods…
0
votes
0 answers

Service start on boot and don't killed after Activity onDestroy()

I want to start a service when device is booted. I found BOOT_COMPLETED intent filter. I also want the service running all the time, if the application call onDestroy(), the service is always running. Resume of my goal: MainActivity <->…
0
votes
0 answers

SocketServer.accept() crash App or Sometimes not working

Whenever I call SocketServer it force closes app. If I run it in background Service then it skips that Code. public void run() { try { //Log.e("Debugging Data: ", "-------------->>>>> Here …
0
votes
0 answers

Is this way for checking if a service is running really that bad?

In my app which is a mediaplayer, i want to know if my Service is running or not. The reason i want to know this is because i only want to bind my service when it's already running. When my app is opened and a song is clicked i call the method…
Vince VD
  • 1,506
  • 17
  • 38
0
votes
1 answer

Accessing one service from two activities

I have an app for which I have created a background service to provide GPS location updates - because GPS will not normally give fast updates when the activity is in the background for battery consumption reasons. It basically works fine, service is…
0
votes
0 answers

How to check what the android service is currently doing once binding to it?

Let's say I have a an Android started service that does some tasks as this example: -Service starts -Does task A, does task B, then downloads file 1, downloads file 2, and Finally does task C. -Service stops Let's say while the service is doing…
0
votes
0 answers

Get Data From Another Application's Activity?

Youtube App allows to play a video by its video id. But I need the inverse of that I need the video id that plays on Youtube App. I checked YouTube Android Player API but I couldn't find any way to do this. I checked Android Services to interact…
0
votes
1 answer

How to retrieve messages from a service in an AlertDialog Android Kotlin

I have implemented a barcode scanning program which grabs barcodes from a barcode scanning service. Within this program I occasionally open a dialog box with an editText field for additional information, I would like to know how I could get the…
0
votes
1 answer

Unable to test external service binding Android in InstrumentedTest

I'm trying to test an external binding to a Service I've defined. Following the class I'm using for instrumented test: @Rule public final ServiceTestRule serviceRule = new ServiceTestRule(); @Test public void testWithBoundService() throws…
0
votes
1 answer

Should i bind my service or call startService multiple times?

I send data between my activity and my service through an intent ( i call startForegroundService multiple times because this call onStartCommand again and with getIntent i fetch my data). Example: Intent intent = new Intent(getActivity(),…
Vince VD
  • 1,506
  • 17
  • 38
0
votes
0 answers

Running an Android service 24*7

I have 2 applications App A and App B. App A has activities and fragments and App B has just 1 service. The requirement is that: 1. The service in App B should be running 24 * 7 to cater to App A. 2. Based on some cloud response that the service…
DevAndroid
  • 1,150
  • 1
  • 10
  • 23