background-service

Android Bluetooth background listener

吃可爱长大的小学妹 提交于 2019-12-03 03:57:15
I am developing an android application with bluetooth chat. I have successfully implemented bluetooth chat with two phones.But my problem is that if I Change to next activity from the chatting activity the connection is lost then I am not able to send messages from second activity. How can I maintain my connection? That is I want to stay connected through out my app. Whenever the user press on exit button then only the connection can disconnect. I want to send message from one activity and receive from another activity this is what I want. I am not able to create a background service with my

Get LocationUpdates in background service continuously

别等时光非礼了梦想. 提交于 2019-12-03 03:40:39
I am working on application which requires to fetch location updates continuously in background service. I have used background sticky service with which it is working. But service is not starting after boot complete even though I have added boot broadcast and have started the service there. Service starts and immediately gets killed. Also, this is not working on Oreo. Service stops after few minutes of application gets closed and never restarts till app is relaunched. I have gone through lot of links, blogs which suggest to use AlarmManager/JobScheduler/JobIntentService but didn't get

NullPointerException on AlarmManager.setRepeating() - ElapsedRealTime - Android

蹲街弑〆低调 提交于 2019-12-02 17:31:45
问题 I am developing an android app, which turns the wifi on/off after every 5seconds (5seconds are just for testing) If this information helps: I am using a NavigationDrawer for this app. I am using elapsedRealTime alarm for this. The user selects the time from a dropdown and after the selected time the app turns wifi on/off. For example: When he (the user) selects 30 minutes from the dropdown (spinner), the wifi should be turned on/off after 30minutes. I think that I have everything implemented

Problem in Background Thread in iPhone

扶醉桌前 提交于 2019-12-02 11:51:21
I am using Background Thread to update one of my label I am using the following code. But in iOS 4.0 i have learn that application saves its states and goes to background. and my application also did that work but the thread i am using stops working when i hide the application and again resumes from where i left when i reopen it. Can anybody please tell me what do I need to change in code in order to make the thread keep on running in background and change my GUI while my application is hidden. I am using this code.. -(void)startThread { NSThread *thread = [[NSThread alloc] initWithTarget:self

NullPointerException on AlarmManager.setRepeating() - ElapsedRealTime - Android

你。 提交于 2019-12-02 09:37:10
I am developing an android app, which turns the wifi on/off after every 5seconds (5seconds are just for testing) If this information helps: I am using a NavigationDrawer for this app. I am using elapsedRealTime alarm for this. The user selects the time from a dropdown and after the selected time the app turns wifi on/off. For example: When he (the user) selects 30 minutes from the dropdown (spinner), the wifi should be turned on/off after 30minutes. I think that I have everything implemented (like BroadcastReceiver , IntentService ). My Code if it helps. Here is how I call my

Android Kills Background Services in Xiaomi, Huawei etc

霸气de小男生 提交于 2019-12-02 06:50:28
问题 I need to make my service unstoppable. I tried to return START_STICKY on start command, it works well on emulator but, when remove the app from task manager on my device (Xiaomi mi5s, Android 7), it doesn't create itself again. @Override public int onStartCommand(Intent intent, int flags, int startId) { return START_STICKY; } Edit: I gave Auto Start permission and disabled battery protection rules for the app. Edit: Also I tried to use foreground service. However, it is being killed too..

Android Kills Background Services in Xiaomi, Huawei etc

馋奶兔 提交于 2019-12-02 06:46:43
I need to make my service unstoppable. I tried to return START_STICKY on start command, it works well on emulator but, when remove the app from task manager on my device (Xiaomi mi5s, Android 7), it doesn't create itself again. @Override public int onStartCommand(Intent intent, int flags, int startId) { return START_STICKY; } Edit: I gave Auto Start permission and disabled battery protection rules for the app. Edit: Also I tried to use foreground service. However, it is being killed too.. @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent,

Android Oreo: Keep started background service alive without setting it foreground (but with a notification)?

穿精又带淫゛_ 提交于 2019-12-01 18:27:26
问题 I am working on a media app. I wonder how I can keep some old behavior my app has prior to Oreo, for example, have the notification and the service (for playback) hang in there even if the service is no longer set to foreground. We call startService(MediaPlaybackService.class) to start the service when playback starts, then create a notification and call startForeground() with it on the service. So far so good - if user exits the app, user will still have media play in the background and can

Android Oreo: Keep started background service alive without setting it foreground (but with a notification)?

☆樱花仙子☆ 提交于 2019-12-01 18:07:14
I am working on a media app. I wonder how I can keep some old behavior my app has prior to Oreo, for example, have the notification and the service (for playback) hang in there even if the service is no longer set to foreground. We call startService(MediaPlaybackService.class) to start the service when playback starts, then create a notification and call startForeground() with it on the service. So far so good - if user exits the app, user will still have media play in the background and can control the playback from the notification. When user pauses playback, we call stopForeground(false) to

Android Silent Push

六月ゝ 毕业季﹏ 提交于 2019-12-01 15:40:44
I am new to android and I'm playing around trying some features here and there. I wanted to know what is the way to use silent push - meaning get a push notification on the device without any alarm, notification or vibration - i.e. without the user to be aware of it. If someone have a tutorial he can refer me to I'll be more than gratefull. The default push in Android (Google Cloud Messaging for Android) is a silent push. You actually have to write code in order for the push notification to generate a notification, sound or any other effect noticeable by the user. Read the GCM Guide . 来源: