6,711 questions
0
votes
2
answers
87
views
Foreground Service: Where should I put the code I actually want to run?
I recently learned about Foreground Services in Android and how to use them.
Often what is used in examples is something like this:
class MyForegroundService : Service() {
...
override fun ...
0
votes
1
answer
58
views
Flutter service starting on bootup receiver but not calling flutter app
I'm developing a flutter app blocker. The idea is simple: the user opens a monitored app and then is redirected to a screen on my app. The screen has multiple controllers so I'm making it in flutter ...
0
votes
1
answer
55
views
What is the correct way to send continuous data from a Foreground Service to a ViewModel?
I'm implementing a foreground service in Android (Kotlin) that handles GPS tracking. The service continuously calculates and must expose these values: Distance traveled, elapsed duration, current ...
1
vote
1
answer
96
views
Capturing the camera on android in the background with preview after processing with OpenCV
My goal is to be able actively process an image in the background, but when the app is in the foreground I'd need a preview which shows the processed image, meaning the original frame and bounding ...
0
votes
1
answer
57
views
Projected screen using Media Projection API is not showing on a surface view overlay in android studio
I'm developing an app that records the screen using the Media Projection API and transmit the data to an overlay surface view, however, the surface view and overlay components are visible but the ...
1
vote
0
answers
83
views
How to fix Play Store warning: ForegroundService not allowed from BOOT_COMPLETED in Android 14/15?
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-...
1
vote
1
answer
54
views
If the app offering the bound service is not running, can external components still use it? Does the app need to be running?
I've read that maybe I should declare <service android:enabled="true" ... /> or android:exported="true" in Manifest.xml, or I should use pass BIND_AUTO_CREATE to bindService()...
0
votes
1
answer
66
views
Overriding the app's default language - starting the app from the background causes localization issues
So my app has multiple languages:
Currently I set Polish, and English is system default.
App's build.gradle.kts:
android {
androidResources {
generateLocaleConfig = true
}
...
}
...
0
votes
0
answers
30
views
Why is the NotificationListenerService stops receiving notifications after the screen is turned off
I added some logs in the NotificationListenerService service:
class NotificationListenerService : NotificationListenerService() {
override fun onDestroy() {
logi("on Destroy")
...
1
vote
1
answer
130
views
Playing media in the background and stop it when needed
I want to create an activity that includes an androidx.media3.ui.PlayerView. The player should play a video using a foreground service, allowing media playback to continue even when the app is ...
0
votes
0
answers
27
views
updating multiple notifications each second in android doesn't work
I have a foreground service which is basically used for counting down from certain number.
As 1 foreground service can have only 1 notification, I show other notifications using notification manager, ...
1
vote
0
answers
75
views
Overlay window is empty despite receiving data via MethodChannel in Flutter
I have a Flutter app that uses FlutterOverlayWindow and MethodChannel to show breaking news overlays. The red overlay UI appears, but it shows no content (missing title and date). I’ve attached the ...
0
votes
1
answer
58
views
Process is not killed even after swiping off from the recents section
I am working on a bluetooth Android application to read data from a device.
Issue: When I kill the app by swiping it up from recents in Samsung, the process is not killed. I checked in Running ...
0
votes
0
answers
38
views
Start forground service in home widget
When I use the start foreground service in the home widget, I get the error ForegroundServiceStartNotAllowedException. And when I use start service, it runs without error. However, I need to use the ...
0
votes
1
answer
81
views
Access android device camera into a service
I am stuck into a problem programming an android application, using Java. I am implementing a Service, since my application should run in background, without affecting the other functionalities of the ...
0
votes
1
answer
116
views
java.lang.SecurityException: Not allowed to start service Intent without permission com.wssnps.permission.COM_WSSNPS
I am getting this exception
java.lang.SecurityException: Not allowed to start service Intent { act=data cmp=app/**.ServiceActivity (has extras) } without permission com.wssnps.permission.COM_WSSNPS
...
-1
votes
1
answer
50
views
android implement expire duration change using countdown timer even when app in background
I have an e commerce app in which I have a list of elements which comes from backend, each item has its expiration duration like (5 minutes) for showing discount.
Each time I call api, it sends me ...
0
votes
0
answers
74
views
How do I set up an Android service in the recommended app architecture
I have inherited a WearOS app, which needs to use the watch sensors to record health data, such as heart rate, temperature and acceleration. The app is made in Java, is around 7 years old and it doesn'...
0
votes
0
answers
50
views
How to Implement Foreground & Background Services in React Native CLI (Latest Android SDK)?
I am working on a React Native CLI project and need to implement Android services, specifically Foreground and Background services. However, most of the tutorials I’ve found are outdated, and the ...
0
votes
1
answer
91
views
Why is my android services process ends the moment it starts?
I'm trying to build an android service that continues the bluetooth low energy scan from my jetpack compose app that interacts with a ble beacon. My goal now is simply to get my foreground service ...
0
votes
1
answer
81
views
Start another application from a service in Android 11
I'm developing some applications with kotlin that will communicate with each other. This case affects 2 of those applications: a service and an application to play videos. The development is for a ...
1
vote
1
answer
389
views
Connect service with app via AIDL in AOSP
I'm trying to connect HAL service to the user app via AIDL. I've tried connecting app to service without luck. How to properly connect user app to HAL C++ service via AIDL? What am I doing wrong?
For ...
0
votes
0
answers
44
views
No custom broadcasts are received on an android service
I'm developing some apps for a specific device running Android 11 (API level 30) in kotlin. I have 2 apps that need to communicate with each other and I have thought to do it using custom broadcasts. ...
1
vote
0
answers
65
views
Plugin for Android Application is Unable to Locate Service
my team and I are working on a plugin for the Android app CivTAK. Plugins in the context of this application are treated as individual apps with just a Service and no Activity that are discovered by ...
0
votes
1
answer
101
views
Text display in random position in all other activities of app, by triggering from one activity
I have Main, Home activities are there Launcher app side (.apk). PlayActivity, Profile, and Init are there on the library side (.aar)
from the server side 1 message will trigger, then I want to show ...
0
votes
1
answer
132
views
Android Studio - Timeout error xml preview
The preview took too long to load. The issue can be caused by long operations or infinite loops on the Preview code. If you think this issue is not caused by your code, you can report a bug in our ...
1
vote
0
answers
362
views
Flutter app crashes: Context.startForegroundService() did not then call Service.startForeground()
I am using flutter background service to run a beacon scan in the background and in the foreground when the app is disconnected.
I get the folowing response when the app crashes. The app only occurs ...
2
votes
1
answer
1k
views
Crash with ForegroundServiceDidNotStartInTimeException on Android 14
I have foreground service with notification that tracks user location, but in the Crashlytics I see that the app crashes for some users with Android 14. I can not reproduce it.
Fatal Exception: ...
0
votes
0
answers
32
views
Have Activity and Service observe the same flow
I have an Activity and a Service who both use the Room database data.
I have the following code for observing changes to the data:
viewModelScope.launch(Dispatchers.IO) {
repository.read().flowOn(...
0
votes
1
answer
83
views
(Android) Calling activity from service using startActivity(intent) gets called for the first time, but fails to run second time
I have an activity which i call from service, I am using startActivity(intent) to achieve it, it works fine when i am triggering it for the first time, the activity gets launched properly. But if I ...
1
vote
0
answers
42
views
Android can not start Service with ForegroundServiceStartNotAllowedException
I have a Service called ServiceTechnicianTrackingService that tracks location with foreground notification of the people using phone.
public class ServiceTechnicianTrackingService extends Service {
...
0
votes
0
answers
89
views
How to dynmically Register a explicit broadcast from a foreground service?
Using Android 14.
As per my understanding Broadcast receivers for Implicit broadcast can not be registered statically in manifest anymore( except few ) but for Explicit intent It can be done both ways....
1
vote
0
answers
216
views
In Android 15 can a Device Admin App start a service from the background
With the recent changes in Android 15 where there are even more restrictions on starting services from the background I have not seen if device admin apps are part of this restriction.
Before I would ...
0
votes
0
answers
243
views
Screenshot in Android with MediaProjection
I am a newbie in android programmin and write small application with Kotlin in Android Studio 2024. I need make screenshot of another application. I see MediaProjection as good way. My app has ...
1
vote
0
answers
82
views
Broadcast between Service and Activity does not work with NOT_EXPORTED flag
I want to send and receive Broadcast between Service and Activity.
I registered programmatically created BroadcastReceiver both in Service and Activity with using flag RECEIVER_NOT_EXPORTED for make ...
1
vote
0
answers
90
views
How to play sound from Glance widget using MediaSessionService
I'm trying to write an app that allows audio to be launched from an app and widget using Jetpack Compose and Glance Widgets. The app shows all audio from the device, which can be controlled (start and ...
1
vote
0
answers
117
views
How to startActivityAndCollapse(PendingIntent) from quick settings on locked screen of Android 14?
I want to show an activity when the users taps on a quick settings tile while the screen is locked. This works as expected using the startActivityAndCollapse method taking Intent as parameter (...
0
votes
1
answer
58
views
How to manage an Android service with multiple operations?
I had recently joined a new company and have taken over a project that has been on-going for years. The unfortunate problem with this picture is that some of the code has been badly maintained and the ...
1
vote
0
answers
229
views
Android Codec2 component store service crashes while stopping the service
I am debugging a crash issue reported in the Android Codec2 integration of an audio decoder. The decoder component starts as a lazy service. Please see the source code below,
int main()
{
ALOGE(&...
1
vote
0
answers
167
views
Accessibility Permission revoke
After auto-updating the application, the accessibility permission is automatically revoked, even though it was already granted. The device's OS is Android 10. There are multiple devices on which my ...
0
votes
1
answer
92
views
my app does not send the notifications in scheduling on android studio
I've been working on this project for a few days, and either it sends a notification at the moment I schedule it or never. As it stands right now, it creates the channel and the notification, but it ...
3
votes
0
answers
418
views
Foreground Service Location being killed by android after 5 mins of inactivity
First let me be clear about my project deails
Requirement : I need to send my user location to server constantly for about every minute
Problem : Android is killing my service after about 5 mins of ...
0
votes
0
answers
137
views
Binding to a DeviceAdminService and calling its methods
I have a device admin app that is the device owner and I want to bind to the DeviceAdminService class that the admin app has from another app.
The problem is that the DeviceAdminService class has ...
0
votes
0
answers
186
views
How to avoid an Android Service being killed when app is closed?
Delphi 11.1
I need to start an Android Service which stays running even if the app is closed by the user or killed by the OS. The app has an SQLite database in the documents folder and the service ...
0
votes
0
answers
34
views
Flag in android service changed for another companion object
I have an aidl interface in the client and server applications with which I connect from the Client application to the AIDLApiService service of my Server application. I call 2 methods on the ...
5
votes
1
answer
280
views
How to avoid ForegroundServiceStartNotAllowedException on retry operation for long-running workers?
I have a long-running worker that performs network operations. If a network error happens during the operations, the worker is stopped with the Retry worker result. Android then automatically restarts ...
3
votes
1
answer
4k
views
My Foreground service is crashing on Android 14
I am implementing an android application with a service that is returning the location so , i have set the attribute foregroundServiceType to "location". Here is my service in the manifest ...
1
vote
1
answer
95
views
Android service and thread in singleton are the equivalent?
There is my WifiConnection class that encapsulates the process of connecting and receiving data via Wi-Fi Direct (peer-to-peer). It can contain thread {} or a CoroutineScope(Dispatchers.IO) for socket ...
0
votes
0
answers
87
views
onServiceConnected not called but context#bindService return true
I am experiencing an issue where the onServiceConnected callback is not invoked in my client code, despite the service's onCreate and onBind methods being called successfully and return a binder. The ...
1
vote
0
answers
559
views
How can I make an app reopen when closed on an Android device?
I have a .bat file. This file contains code that reopens an application when it is closed. So how can I run this on Android? I want it to constantly check in the background and run it if the ...