Skip to content
Advertisement

Tag: service

android 10 is crashed when starting bluetooth service

in a couple of days before, I wrote some lines of code to connect application to a HC-05(a Bluetooth module) via a service. I know that a simple service can not be alive in a android 8+. so I modify my service using some free tutorials available on YouTube channels like the following: https://www.youtube.com/watch?v=BXwDM5VVuKA android 7- don’t have any problem

Android application with MVVM architecture, writing to local Room database from a Service using MVVM, how should the Service write to the database?

In MVVM we have Activities and Fragments. Fragments and Activities have access to ViewModel. ViewModles have access to Repository. Repository has access to local and online database. I want to build a Service component so that when the application is put on background the Service should continue to write to the local database. This is how my application looks like:

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 without binding? It works, but Iā€™m not sure if it has any memory leak implications or any other issues.

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

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question 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

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 outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? I have also included this flag to my Intent, but it’s still showing the same

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 is the source code: AndroidManifest.xml I added the uses-permission and service tags: LogWatcherService.java I added FileObserver inside the service, and overrided its onEvent method: MainActivity.java I start

Advertisement