foreground-service

How to cancel an ongoing notification of another app?

若如初见. 提交于 2020-01-12 04:47:26
问题 Background I've found an app that somehow hides heads-up notifications, including even ongoing notifications (used by foreground services), called NCleaner . I was wondering how such a thing works. The problem There isn't much information of how to control notifications of other apps. Only of the current app, and for some reason I've failed to cancel an ongoing notification, but I've succeeded canceling a normal one. What I've found I've found this sample showing how to monitor notifications.

Background Services are restricted in Xiaomi and Oppo

别说谁变了你拦得住时间么 提交于 2020-01-09 05:27:30
问题 We are developing an app With MQTT running in a foreground service. The problem is on Xiaomi Redmi Note 7, the service gets killed after we kill the app but on other brands It works fine. I did not test the app on Oppo and Vivo but as I searched they have problem too. In onCreate method of the service, I called startForeground(NOTIFICATION_ID, notification) and my service declaration in manifest is like this <service android:name=".service.mqtt.MqttService" android:enabled="true" android

Background Services are restricted in Xiaomi and Oppo

旧巷老猫 提交于 2020-01-09 05:27:07
问题 We are developing an app With MQTT running in a foreground service. The problem is on Xiaomi Redmi Note 7, the service gets killed after we kill the app but on other brands It works fine. I did not test the app on Oppo and Vivo but as I searched they have problem too. In onCreate method of the service, I called startForeground(NOTIFICATION_ID, notification) and my service declaration in manifest is like this <service android:name=".service.mqtt.MqttService" android:enabled="true" android

Sticky foreground service fails to restart with a “process is bad” error

假装没事ソ 提交于 2019-12-31 09:11:42
问题 I have a started foreground service. I've taken care to return START_STICKY from onStartCommand . I've observed that foreground services don't run indefinitely but are periodically terminated by an Android internal module called the RestartProcessManager . Essentially a process LRU is maintained and the newly terminated service gets scheduled again if it's configured to do so(sticky or not). The issue I'm facing is with how the restart is being handled. Logcat indicates the service intent was

A notification of the foreground service doesn't show on Android 8.+

假如想象 提交于 2019-12-31 04:58:08
问题 My foreground service doesn't show a notification when it works on Android Oreo. It works perfectly on Android versions from 15 to 25. When I do targetSdkVersion from 26 to 25 this issue disappears. But this solution seems not good. I prepared test project with this issue. What should I do for fixing it on Android Oreo with targetSdkVersion 26 ? My foreground service, SoundService.java(full source): public class SoundService extends Service implements MediaPlayer.OnErrorListener, MediaPlayer

Android 7.0 Kills App Even When Foreground Service is Running

痴心易碎 提交于 2019-12-24 21:29:51
问题 I have tried every suggestion I could find on the Internet to use Foreground Service to keep my app running beyond sleep and deep sleep modes but nothing has been successful so far. I am working on a taxi booking application. I designed it to start emitting driver's location to server whenever the driver turns himself Online and stop emitting when Offline. The following is the Foreground Service code that is started whenever driver turns himself Online and stopped when he presses online

Android 8 Foreground Service with Notification Channel

北慕城南 提交于 2019-12-21 17:46:19
问题 I want to start a foreground service in Android 8 and I want to know how are foreground services compatible with the notification channel system. Let's say we start a foreground service, then we immediately create the required notification and assign it to a notification channel. Suddenly, the user decides to go into System Settings and disable the notification channel. What happens in this case? Will the service become a background service? Does it get killed? I haven't found a documented

Android InstantApp: Foreground service

房东的猫 提交于 2019-12-21 05:57:29
问题 Unable to use foreground service inside InstantApp feature module. Getting below runtime security exception. java.lang.RuntimeException: Unable to start activity ComponentInfo{ . .XYZActivity}: java.lang.SecurityException: Method class android.app.ActivityManagerProxy.getServices not available to instant apps Android document says, Restricted features: Run on the device without users being aware. Foreground services are available. Instant apps can only be started through activities that

Context.startForegroundService() did not then call Service.startForeground()?

我的梦境 提交于 2019-12-20 20:15:18
问题 I have hundred of crashes reported by my users and I still can't find a fix for it. These crashes are coming from Android 8 (Samsung, Huawei, Google). I am getting these two crashes: Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1881) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android

Context.startForegroundService() did not then call Service.startForeground

女生的网名这么多〃 提交于 2019-12-19 08:33:45
问题 My app will call startForegroundService(intent) in the onCreate of the MainActivity . And I put startForeground(ON_SERVICE_CONNECTION_NID, notification) in both the onCreate and the startCommand of the Service . But I'm still receiving this error occasionally. Exception android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() android.app.ActivityThread$H.handleMessage (ActivityThread.java:1775) android.os.Handler.dispatchMessage (Handler