How to access a variable of a service from an activity

I understand that in order to access methods of a service from an activity, we should bind the service. But if we just want to get the value of a variable in the service, can we just access it like so …

How to properly use 3 – layers architerchture in Spring MVC – Java

I come before you with a confusion that, perhaps, you can clarify to me. I’m learning now how to use 3-layers architecture with Spring MVC (using Repository, Service, Controllers), but I don’t …

Implementing exit app button in the persistent notification

My app runs a background service indicated by the persistent notification. Users need to use the toggle button in MainActivity to turn on/off this service and thus to remove the persistent …

Android service not working when app is closed

I’m having trouble with an android service that I’m doing. The service is about to get the location of the user every 5 minutes. All seems to go well except when i kill the app, the service won’t do …

How can I create a notification channel for Android API level < 26 (before Android Oreo)? [closed]

I am currently working with an Android service: https://developer.android.com/guide/components/services I am creating a service that has to be a foreground service. But looking at the documentation, a …

Using Intent.createChooser and getting error: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag

I want to open the share via option from the service class. It is working fine in Android 7, but in 8+ OS it starts showing android.util.AndroidRuntimeException: Calling startActivity() from …

Can’t use FileObserver to Observe Files Inside a Folder

I want to observe if any file/folder is added inside /storage/emulated/0/DCIM/Camera using FileObserver in a service, but it didn’t work. Please tell me if there is anything wrong in my code 🙏. Here …

Android – Running a background task every 15 minutes, even when application is not running

I need to build a background task that runs every 10/15 minutes (doesn’t really matter, either is good), even when the application is not running. How can I accomplish this? I can’t seem the wrap my …