I\'m monitoring incoming SMSs.
My app is working perfectly with a BroadcastReceiver
. However it is working from an Activity and would like to keep the <
Beside @Javanator
answer I would like to include a case for Android version of (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
In my case this is working for Android SDK 29 (10)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(new Intent(context,FloatingWindow.class));
} else {
context.startService(new Intent(context, FloatingWindow.class));
}