Questions tagged [startforegroundservice]

9 questions
3
votes
0 answers

Fatal Exception: android.app.ForegroundServiceStartNotAllowedException even when app is not in background

I have this piece of code on MainActivity that starts a foreground service when the app is resumed. private final Handler handler = new Handler(); private final Runnable runnable = () -> { Intent intent = new Intent(this, MyService.class); …
3
votes
1 answer

Caused by android.app.ForegroundServiceStartNotAllowedException startForegroundService() not allowed due to mAllowStartForeground false

I have upgrade the Android SDK project 30 to 31. Also i am using the the Android Beacon Library for scanning the the iBeacon. Android 12 i am getting the frquently below crashes on 100% background application. Caused by…
1
vote
0 answers

Broadcast Reciever ACTION_SHUTDOWN Intent is not working in Android version 11

Foreground service class code for calling the shutDown broadcast receiver. public class SmsForegroundService extends Service{ private BroadcastReceiver receiver; public static class MyReceiver extends BroadcastReceiver { …
1
vote
0 answers

Application keep crashing, when i try to show() AlertDialog from a ForegroundService

I try to build an app, where you type the Username and Pass in the MainActivity, which will start a ForegroundService and in an endless loop keep sending User and Pass to a PhP server. App is working fine, keep receiving the response and service…
1
vote
1 answer

Android stop foreground service executes onStartCommand

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…
Hak
  • 69
  • 8
0
votes
0 answers

Network access in Android DOZE Mode

The Android App targeting Android 9 and above is not been able to access the network in Doze mode. Have implemented a background sync service that pulls data from the central server in regular intervals. It all works till the time it enters into…
0
votes
0 answers

How to Send Data to the Main Activity from a Foreground Service in Android?

I am currently using the Linphone library to handle call functionality in my Android app. I have implemented a foreground service that initializes the Linphone's code, core, and listener. The goal is to notify the main activity when there is an…
0
votes
0 answers

flutter_foreground_task causing crash in iOS devices

I have one app that is using two packages one is flutter_foreground_task and one is awesome notification.Awesome Notification main task is to show the notification to the user and flutter_foreground_task main task is to implement the foreground…
0
votes
1 answer

startForegroundService() does not start service on 2 Samsung devices

The code to start this service now looks like if (!BuildConfig.MSG_ALLOWED && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Log.v("Foreground SmsService Launch"); context.startForegroundService(intent); } else { Log.v("Regular SmsService…
kencorbin
  • 1,958
  • 1
  • 20
  • 18