android-service-binding

Android Mosby MVI bind to service in presenter

这一生的挚爱 提交于 2019-12-22 17:22:04
问题 I am creating a small app using Mosby. The app has a service which I want to bind to. I guess the correct place to do this is in the presenter. But I can't really figure out how to do it. What I want to archive is when the service is bound I want to call a method on it and push that value to the view, so that the state right now is correct. When the service sends updates on the event bus I want to push that to the view as well. I have found some example on the later part, but nothing about

Bind to service from new Context for configuration changes or bind from app context?

别等时光非礼了梦想. 提交于 2019-12-20 09:41:43
问题 I'm trying to work out if bound service is appropriate for doing background work in my app. The requirements are that various application components can make web requests through it of varying priority. (Thus the service must maintain some sort of queue and be able to cancel it's ongoing requests for others of higher priority). I'd like the service to be relatively unobtrusive to the user such that they don't find it running after they are done with the application - if I want to do something

Android download queue using DownloadManger

北城以北 提交于 2019-12-19 03:59:29
问题 I'm using DownloadManager to download my files in android and its great since it handles everything (connectivity lost, retry, etc.) The problem is I want my file to be downloaded in queue one after another and as far as i know DownloadManager doesn't provide this functionality. So multiple call to DownloadManager.enqueue(...) results in concurrent download of all the files. How can i fix this? I can not just make a queue in my activity and send downloads to DownloadManger one by one since

How to restart service after the app is killed from recent tasks

夙愿已清 提交于 2019-12-17 09:04:28
问题 I have created a service to fetch current location of the device in periodic intervals. I want the service to run in the background even if the app is cleared from recently opened apps. Currently the service runs in background only until app is present in the recently opened apps but stop immediately when app is swiped off (or killed in some other way). I have tried all sort of help available in stack overflow yet I am unable to solve this. Please help. Here is my code for the service.

How to restart service after the app is killed from recent tasks

只谈情不闲聊 提交于 2019-12-17 09:02:33
问题 I have created a service to fetch current location of the device in periodic intervals. I want the service to run in the background even if the app is cleared from recently opened apps. Currently the service runs in background only until app is present in the recently opened apps but stop immediately when app is swiped off (or killed in some other way). I have tried all sort of help available in stack overflow yet I am unable to solve this. Please help. Here is my code for the service.

Pass Service From one Activity to Another

微笑、不失礼 提交于 2019-12-12 22:21:22
问题 how do I pass a service from one activity to another? I have a music player (Activity1) that displays a list of songs, and when you click on it, it starts the service within Activity1. I have a button that users can click that will open Activity2. So what is the best way for me to pass the service from Activity1 to Activity2. If the service is started in Activity1, then Activity2 should continue playing. If the service is not started in Activity1, then Activity2 should start the service

Android Sensor Shake in the background

风流意气都作罢 提交于 2019-12-12 10:18:37
问题 I'm trying to follow a tutorial about sensor. It works fine with an activity. However, I want this to work in the background when the phone is locked. What's the best way to do that? Here's the link to the tutorial http://jasonmcreynolds.com/?p=388 ShakeDetector class public class ShakeDetector implements SensorEventListener { /* * The gForce that is necessary to register as shake. * Must be greater than 1G (one earth gravity unit). * You can install "G-Force", by Blake La Pierre * from the

Issue Moving from IntentService to JobIntentService for Android O

早过忘川 提交于 2019-12-12 08:57:17
问题 I am using Intent Service to monitor Geofence transition. For that I am using following call from a Sticky Service. LocationServices.GeofencingApi.addGeofences( mGoogleApiClient, getGeofencingRequest(), getGeofencePendingIntent() ) and the Pending Intent calls Transition service (an IntentService) like below. private PendingIntent getGeofencePendingIntent() { Intent intent = new Intent(this, GeofenceTransitionsIntentService.class); // We use FLAG_UPDATE_CURRENT so that we get the //same

Toast not displayed in bound service example using messenger

大憨熊 提交于 2019-12-11 22:38:26
问题 I'm following the example on android guide for bound service using messenger and running the following code snippet. I've modified the snippet slightly to have a hi and a bye button and the service should display the toast hi or bye depending on which button is pressed on UI. But on running the example toast is not displayed. Although the message received log is printed on the UI. What is the reason for this. The toast at onStart of Acticity is also not displayed. public class

Binding few activities to one service - class which connected treated like service - can't destroy activity

吃可爱长大的小学妹 提交于 2019-12-11 11:58:07
问题 I will start from my approach I want to have one service which is running even if none of application screen is visible for user. This service will scan for beacons. Every screen of application needs to get access to method of service so I used binding to service here. I designed serviceconnector class which will be connecting Activities with service, this class look like this. import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android