Android stop foreground service executes onStartCommand

All we need is a simple explanation of the problem, which is provided below. Why calling context.stopService(stopIntent) is going to execute onStartCommand am i missing something? i had to do this in the onStartCommand if (ACTION_STOP_SERVICE == intent?.action) { stopSelf() } While the doc said specifically this: onStartCommand Called by the system every time a … Read more

is it recommended to use Android WorkManager for long tasks?

All we need is a simple explanation of the problem, which is provided below. I have to create an application that activates the proximity alert at certain times of the day (this period of time can be several hours long). The proximity alert must be started automatically, even if the application has never been opened. … Read more

Android 12 (SDK > 29) Extra_Output for ACTION_IMAGE_CAPTURE not working

All we need is a simple explanation of the problem, which is provided below. I want to take a picture with the camera and then send it to another activity. Everything works on the emulator without any problems. But as soon as I try the app on my real device, I always get the status … Read more

Want to add a delay for textView when using livedata that pass LatLon

All we need is a simple explanation of the problem, which is provided below. Are passing data between a service to a fragment using a MutableLiveData. Accordenly to a Log.d statement the data is recived. But when i try to use TextView to display the data i get null. It think a delay makes it … Read more

Does overriding Service.OnStartCommand put the service into the started state?

All we need is a simple explanation of the problem, which is provided below. In the bound services documentation, it says When a service is unbound from all clients, the Android system destroys it (unless it was also started with a startService() call). As such, you don’t have to manage the lifecycle of your service … Read more

How to send an initial message using ServiceConnection?

All we need is a simple explanation of the problem, which is provided below. I have an android service, which is connected to a service connection. Upon initialization, I’d like to send a single String, for example "test message" to the Service connection. How would I do this? This is my Service class: public class … Read more

Is using a Service onStartCommand for multiple intents bad practice?

All we need is a simple explanation of the problem, which is provided below. I have a long-running foreground service which generates high priority notifications that require a yes/no button press in order to be dismissed. The button presses are handled by addAction calls, where I must send in an Intent that will transmit the … Read more

What happens when back button or home or application removed from recent apps

All we need is a simple explanation of the problem, which is provided below. I want to know what happens when back button pressed, is there any data loss? Or we simply press back button what could be possibly done to that state or there is data loss when we press home button, and lastly … Read more

How to check whether a service in running on particular port using adb

All we need is a simple explanation of the problem, which is provided below. I have a third party application in my android phone. The application offers a service at 127.0.0.1:30002. I don’t know the name of service. Is there a way to find out whether that tcp service is up or not using adb … Read more

I want to show gif image show on screen even when app is closed

All we need is a simple explanation of the problem, which is provided below. With a mouse click, you implement two things: Sound is playing The GIF image is showing I’m trying to show the GIF on the screen even when I close the app I’m using the services but because the sound keeps playing … Read more