android-service

How does doze mode affect background/foreground services, with/without partial/full wakelocks?

删除回忆录丶 提交于 2019-11-26 12:44:20
问题 This is a simple question, seeing that there is a huge post about this on G+ (here), and lack of information on official docs (here ): What happens to the app\'s services when the device goes to \"doze\" mode? What does it do to background/foreground services (bound/unbound, started/not-started), with/without partial/full wakelocks? What would you do, for example, in order to create a service that plays an audio stream while the device\'s screen is turned off? What if the audio stream is not

Restart the service even if app is force-stopped and Keep running service in background even after closing the app How?

佐手、 提交于 2019-11-26 12:40:00
问题 I am trying to run a service in the background. What my app does is when user checks checkbox then service starts and when it is unchecked service is stopped. Which is working perfectly fine. But the problem is when I closed the app from task manager it then also stops the service. What I want is to keep the service running even after it is close from task manager. Then only way to stop that service is by user himself by unckecking the box. How can I achieve this? Here is my code My main

Internet listener Android example

£可爱£侵袭症+ 提交于 2019-11-26 12:24:59
问题 I am working on an Android app that will continuously remain connected to Internet. If Internet is dow, it should give an appropriate message to the User. Is there any thing like Internet Listener? Or how to implement this event that whenever Internet connection is not available it should give alert. 回答1: Create one Broadcast Receiver for that and register it in manifest file. First create a new class NetworkStateReceiver and extend BroadcastReceiver. public class NetworkStateReceiver extends

How to find the currently running applications programmatically in Android?

谁说胖子不能爱 提交于 2019-11-26 12:24:32
I am very new to Android. I am working on application that must get the information about the applications currently running on foreground. It means if user launches any applications, my application should capture the launched application information, by the time my application shouldn't interrupt launched application. Example: If user launches browser application my application should print browser application information on log. How can I do this? drooooooid ActivityManager activity_manager = (ActivityManager) context .getSystemService(Activity.ACTIVITY_SERVICE); ActivityManager has method

SpeechRecognizer causes ANR… I need help with Android speech API

天涯浪子 提交于 2019-11-26 12:12:18
问题 EDIT : I should have mentioned this already, but I\'m running this code in a service. The entire app is turned on/off by a widget button and has no activity. Update : I tried attaching the SDK sources to the project so I could get a more precise idea of where the failure was occurring, but from the looks of it, only public APIs are included, which seems to make them a lot less useful... can anyone suggest at least a debugging approach for solving this issue? I\'m kind of stuck. I\'m trying to

Broadcast Receiver within a Service

佐手、 提交于 2019-11-26 12:05:22
I am trying to start up a BroadcastReceiver within a Service . What I am trying to do is have a background running service going that collects incoming text messages, and logs incoming phone calls. I figured the best way to go about this is to have a service running that incorporates a broadcast receiver that can catalog either. How do i go about doing this? I already have my service up and running. as your service is already setup, simply add a broadcast receiver in your service: private final BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context

Is there any way to run service continuously in android?

佐手、 提交于 2019-11-26 11:24:52
问题 There are few questions similar to this on StackOverFlow but none of the solutions are working for me Problem The problem is with only few devices like OnePlus and MI ,The service is getting killed as soon as the user swipes away app from recent app. I read that these OEM\'S use some aggressive strategies to kill services . I just want to know is there any way to keep service running or start it as soon as it gets killed . What I want I need to run a service which will give location

Creating an Android Service with Phonegap? (Have phonegap app run even when closed)

别说谁变了你拦得住时间么 提交于 2019-11-26 11:10:31
I have been working on an Android app using Phonegap and now would like to make it so when the app is closed it can still execute the java/js code in the app. So I understand I need to create a service. If I create a service plugin on phonegap can I still execute the javascript code or only the java? Has anyone does something like this? I found this discussion but did not seem to work: http://groups.google.com/group/phonegap/browse_thread/thread/722b0e796baa7fc6 So that is all I have right now. Before I turn to developing it native if I can't figure it out thought I would ask if anyone has

Android application as a service without activity

一世执手 提交于 2019-11-26 10:58:01
问题 I am making a set of apps and I have pretty much the same background service for all of them. I\'m trying to make an app that has only this Service . so I don\'t repeat it in all of them, but the thing is don\'t need any Activity . because there is no UI needed for it, and so the user can\'t close it except if they stop the Service . I tried to remove the Activity , but then the app doesn\'t run or start. My question is: can I make an app exactly like Google Play Services so other apps can

How to startForeground() without showing notification?

两盒软妹~` 提交于 2019-11-26 10:15:49
I want to create a service and make it run in the foreground. Most example codes have notifications on it. But I don't want to show any notification. Is that possible? Can you give me some examples? Are there any alternatives? My app service is doing mediaplayer. How to make system not kill my service except the app kill it itself (like pausing or stopping the music by button). As a security feature of the Android platform, you cannot , under any circumstance, have a foregrounded service without also having a notification. This is because a foregrounded service consumes a heavier amount of