Questions tagged [android-service]

A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.

Filter by
Sorted by
Tagged with
1 vote
0 answers
26 views

Weird issue, my app's service minimize other apps when it's enabled?

If the user enables an option in my app called Quick Launch whenever they plug the charger into their device, my app will automatically open. The issue is that when this Quick Launch option is enabled,...
Mouaad Abdelghafour AITALI's user avatar
0 votes
0 answers
12 views

Android Download Manager - file stuck in pending until WiFi is turned on

I'm using Download Manager to download a file Ton an Android 10 device that is connected to a private APN on cellular network which leads to a private server. *The server is not reachable from regular ...
Roni Beitel's user avatar
0 votes
0 answers
11 views

What is the best way to schedule a job on android WorkManager, ScheduledExecutorService, AlarmManager

I need to run a service that upload files to the could. I want to let the user customize: At what times during the week If the upload should wait for wifi If the upload sould wait until the battery ...
Gil SH's user avatar
  • 3,789
0 votes
0 answers
17 views

How to use Service in Composable Component which created by MainActivity

I am creating a Service to connect and read data from Bluetooth. class MainActivity : ComponentActivity() { companion object { lateinit var serialService: SerialService } var dataListener: ...
Dina's user avatar
  • 146
0 votes
0 answers
16 views

What should I use to Listen for incoming calls services in Android or work manager of Android?

I am developing an application that needs to monitor incoming calls continuously, even when the app is not active. Initially, I implemented this functionality using broadcast receivers and services in ...
Shivam Gupta's user avatar
1 vote
1 answer
13 views

Service in the foreground not allowed to start background in service in another app on Android 12

I have started a service and elevated it to foreground status, which seems to work. However now I want that service to start another service running in the background of another (unstarted) app, but ...
JohnyTex's user avatar
  • 3,353
-2 votes
0 answers
19 views

How to manage Play/Pause multiple play sound from notification in android

I'd play multiple sounds in my app I want to manage play and pause all sounds from notifications. For example. I play "ABC" & "XYZ" How to create a single notification for ...
Abhi Plx's user avatar
0 votes
0 answers
31 views

Overlay Compose View is not visible after removed and added again (Service, WindowManager)

Behavior: when I remove the compose view and add again, it's not show anything. Like in the video below, when I click popBack button from the expanded view, the small bubble is expected to show again. ...
TorryDo's user avatar
  • 55
0 votes
1 answer
26 views

Request dangerous permission for wear os watchface

I'm trying to create a watch face using some data. However, I need access to ACCESS_FINE_LOCATION to get the user's location. From the sample provided here, the watch face is launched as a service and ...
user3826764's user avatar
0 votes
2 answers
43 views

1 processes and 0 service under Settings, Apps and Running

The application is working, but why is the service not showing up? What is the cause of the problem, given that the Android version 10 Edit has been added super.onCreate(); I used notifications, but ...
Ibrahem Hamdy's user avatar
0 votes
0 answers
23 views

Hilt with Android - Can I inject a dependency inside of a non-main thread Coroutine?

Most of the discussion I see is how to inject the actual Coroutine contexts and workers. That's not what I'm talking about. Say I have a Service myService() and a library that needs to run in a ...
MW2023's user avatar
  • 183
0 votes
1 answer
33 views

What is causing dispatchGesture to fail?

I have an accessibility service defined as: class ClickService : AccessibilityService() { // Pretend the necessary methods are overrided override fun onCreate() { super.onCreate() ...
Edward Yang's user avatar
0 votes
1 answer
33 views

onPause alternative in android service?

I have a android project that requires music to be played in the background. I believe using a service would be the right thing for this so I set one up in the following way: internal class Song : ...
Joshu's user avatar
  • 39
0 votes
1 answer
31 views

Launch a service after device is unlocked/rebooted with API level > 26

I want to create a simple service on Android 13 that will do a task after the user unlocks the device. I found different ideas on StackOverflow but most of them target the API 25 or bellow. Since then,...
tinyestgrape's user avatar
0 votes
0 answers
29 views

Android NotificationListenerService android:exported value

Here is example of declaration notification listener service <service android:name="com.example.notifications.NotificationListenerService" android:exported="true" ...
bene25's user avatar
  • 580
1 vote
1 answer
37 views

Can I define a MediaLibraryService without an app?

I want to define a MediaLibraryService in such a way that Android Auto, Exoplayer, AIMP For Android and other apps can access and play the media my service manages. I don't see a need for a UI/...
Oddthinking's user avatar
  • 24.4k
0 votes
0 answers
16 views

onCreate not call for startService - Native-modules

I use react-native modules. I create a java class that extend service to create a foreground notification. Inside my primary module java class i try to start service with : getReactApplicationContext()...
Sha's user avatar
  • 21
0 votes
0 answers
43 views

Open Google Autofill Settings using Android Intent

I am trying to develop an Autofill service for Android Devices using "Google AutoFill Services" that helps users, to redirect to the google autofill services page so that the user can enable/...
Valencio Araujo's user avatar
-1 votes
1 answer
21 views

Opening main activity after ending second activity

i hope someone can help me with this. I'm opening an activity "B" through a Notification Push using a pending intent. This is working correctly. But I need that when activity B is closed go ...
Luichigo15's user avatar
0 votes
0 answers
60 views

BackgroundServiceStartNotAllowedException android 12 and 13

I have a BaseActivity class which is inherited from other Activities. This is the onResume in BaseActivity class. @Override protected void onResume() { super.onResume(); if (!...
giordy16's user avatar
  • 275
0 votes
1 answer
26 views

What is the best way of passing an handler function to a service in Android?

The problem I'm trying to create a service that makes all the Http Request of my application to my backend. Different endpoints give different outputs, so I basically need an handler function for ...
Pietro's user avatar
  • 141
0 votes
0 answers
13 views

Override function onTaskRemoved of service is not getting called in the Redmi Device

I have an use case like on user kills/clear the app manually, a function to be triggered ,I have tried using the onDestroy unfortunately the fn is not called hence I have gone with service and ...
arun's user avatar
  • 115
0 votes
0 answers
32 views

bindservice does not connect to the service

I try to connect to the service but I can not I can start the service it lansa the notification but does not bind when I call bindservice I already added the request foregraud service and already ...
Ramon Melo's user avatar
0 votes
3 answers
108 views

Why isn't onDestroy event of a service launched in Android Studio project?

When I start ActivityMain in Code 1, a service will be launched, and the service will be destroied after the ActivityMain is destroied , you can see Image 1 for result, it's just like my expected. In ...
HelloCW's user avatar
  • 1,043
2 votes
1 answer
22 views

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&...
Murad Akhmedov's user avatar
0 votes
1 answer
308 views

how to use Jetpack Compose in Service

I want to use Jetpack Compose to implement the floting window UI. But I got this error:java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from androidx.compose.ui.platform.ComposeView ...
Ting's user avatar
  • 21
0 votes
0 answers
13 views

Async Task in Service Returning Null For Payment Connector on Second Run

I am new to android and was running into an issue I was unclear about. I have been stuck at it for a while and no research seems to help so wanted to try posting. I have an android java application ...
z123's user avatar
  • 301
0 votes
0 answers
83 views

Coroutine launched from foreground service getting paused

I am updating a notification every second. @AndroidEntryPoint class StopwatchService : Service() { @Inject lateinit var stopwatch: Stopwatch // scope private val job = SupervisorJob() ...
BPDev's user avatar
  • 451
0 votes
0 answers
19 views

Android Service: detect if startService or startForegroundService was used

On Android 9 and 10, how can I distinguish if my Service was invoked via startService or via startForegroundService? Is there some way in onStartCommand function inside Service? Basically, I would ...
Ariczek's user avatar
  • 83
0 votes
0 answers
35 views

Unable to get location after reboot the phone and internet stays off Android , Service Location

`I'm facing an issue with my Android app where the map fails to load and I'm unable to obtain the user's location after rebooting the device when there is no internet connection. I have ensured that ...
Timelabs DevApp's user avatar
0 votes
0 answers
27 views

Best way to implement a functionality that reads data every second in the background

I am currently rewriting/updating the app that had a background service that was reading CAN data and processing it. Data is being updated every second and it is either stored or if the value meets ...
Chris's user avatar
  • 1
0 votes
1 answer
416 views

Service did not call startForeground even though it does

I am getting an error that does not make sense to me The error I get is RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() I have a ...
tyczj's user avatar
  • 71.7k
0 votes
1 answer
79 views

How to pass data from a Service into a HiltViewModel in Android app?

I have a simple view model class with a state that is being modified by a function @HiltViewModel class MapViewModel @Inject constructor() : ViewModel() { fun addNewLocation(location: Location) { ...
Chaz Ashley's user avatar
0 votes
0 answers
21 views

With a bound service, will onUnbind() be called along with onDestroy() if system decides to kill the service?

If a service is deemed unimportant, it might be killed by the system. I am aware that onDestroy() is not guaranteed to be called when the process is killed too but in situations where the calls go ...
capalloc's user avatar
0 votes
1 answer
195 views

How can we show Custom UI when addNewIncomingCall using Connection service?

I am trying to implement the ConnectionService. When I add new incoming call I get the system UI to receive or to reject a call. var handle = account.accountHandle val extras = Bundle() ...
Mohammad Taqi's user avatar
0 votes
1 answer
36 views

How do I start a service when I receive an intent?

I'm making a wearable plugin for Sleep as Android. It uses an intent-based API, eg upon receiving com.urbandroid.sleep.watch.START_TRACKING, every 2 minutes the app is supposed to send an intent with ...
KTibow's user avatar
  • 532
1 vote
0 answers
85 views

possible to use a ComposeView in an Android Service?

I have a service that is an Application Overlay. I haven't gotten very far, but was able to present a Button on the screen using the service. I decided to try to use a ComposeView instead of a Button, ...
Casey Perkins's user avatar
0 votes
0 answers
45 views

Why android has various types of service and is workManager an alternative to services

I'm learning Android and currently, I am dealing with the background stuff and came to know about two things services and workManager. Before I got started with any of the ones I got to know about ...
ADITYA RAJ's user avatar
0 votes
2 answers
175 views

Killing foreground service on Android

I'm working on Android 12 and I try to (force) kill my foreground service. I can kill it from adb by the command: adb shell force-stop "my service" But when I do it programmatically (as was ...
Amiad's user avatar
  • 361
1 vote
0 answers
160 views

How to execute a foreground service in Xamarin Android app from a Qt Android application

I have a bit of a unique situation. I have a front end QML/Qt UI and a backend application written in C# that I'm developing to replace old software. I was previously using Android tablets with an all ...
HelloWorld's user avatar
2 votes
1 answer
377 views

Android - Overlay view on top of Settings app

I've seen a couple of apps that are able to add overlay views from an accessibility service that are visible when the Settings app is on the foreground on also on the lock screen (!!). I have ...
Anonymous's user avatar
  • 4,500
1 vote
1 answer
28 views

I'm trying to playmusic using service but it's not working

from here i started the service Intent intent=new Intent(getActivity(),MyService.class); s=sn; u=ur; intent.putExtra("uri",u); ServiceConnection ...
mm m's user avatar
  • 55
1 vote
0 answers
201 views

Can't start a Background service in onCreate of an Activity

In my app, I need to keep a background service alive throughout the duration of the app. So, I start the background service in onCreate method. But for some reason, I am getting this on some devices: ...
codeconscious's user avatar
0 votes
1 answer
32 views

How would a previously started Thread within a Service be stopped if said Service is killed by the system and later restarted?

If a Service implements a thread, it would hold the reference to it using a class field, so that it could later stop the thread by calling the proper methods (e.g. quit() or quitSafely() in the case ...
capalloc's user avatar
0 votes
1 answer
183 views

How to start an Activity from Service Android 11

how can i open an Activity in the Background from my Service? The App is running in background and an Intent Brodcast that triggers the start of an Activity within my app. I tried it on an Android 8.1 ...
Hurricane08's user avatar
0 votes
0 answers
33 views

How do I run logic at a exact time in Android?

Background and flow: I'm building the app for Android API 31+. (Tested on an Andorid 33/31 hardware) My app should work as an alarm clock but with a logical check before sounding the alarm, the ...
Martin's user avatar
  • 1
2 votes
0 answers
123 views

I'm experiencing difficulty with network service discovery (NSD) in my android project as I sometimes can't obtain an IP address

I am using the NSD (Network Service Discovery) NsdManager.DiscoveryListener to discover services on the network. However, in the onServiceFound method, I am sometimes unable to retrieve the IP address ...
Pratik A's user avatar
0 votes
0 answers
18 views

Android bound service without IPC

I want to bind my activity to a service that is supposed to die as soon as the activity itself dies. After googling, I found out that bound services are used for this. However, bound services also ...
Anchith Acharya's user avatar
0 votes
0 answers
44 views

Android AlarmManager is not calling PendingIntent when app is in background

In our app, we have functionality where user will get a reminder notification one day before the appointment at specific time. We set the date and time using calendar and in pending intent we give ...
Aniket Dhanrao's user avatar
2 votes
3 answers
97 views

Confused about handling data notification with onMessageReceived: is it called in a different thread? Why can it access global variables?

In iOS, there is an extension called NotificationService. This is completely in a different 'target' and runs next to the main app in a different process. It can not access the main app's code. In ...
J. Doe's user avatar
  • 12.1k

1
2 3 4 5
134