android-service

Continue vibration even after the screen goes to sleep mode in Android

元气小坏坏 提交于 2020-01-23 10:04:21
问题 In my application, I am starting the VIBRATOR_SERVICE through the following code long[] pattern = {50,100,1000} Vibrator vibe=(Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); vibe.vibrate(pattern, 0); I want the vibration continue till I call vibe.cancel(); The Code is working fine, but the vibration getting off when the screen goes to sleep mode. I want the vibration continue even after the screen goes to sleep mode. Is there any ways to do this? Please help me. Thanks in

Continue vibration even after the screen goes to sleep mode in Android

独自空忆成欢 提交于 2020-01-23 10:03:02
问题 In my application, I am starting the VIBRATOR_SERVICE through the following code long[] pattern = {50,100,1000} Vibrator vibe=(Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); vibe.vibrate(pattern, 0); I want the vibration continue till I call vibe.cancel(); The Code is working fine, but the vibration getting off when the screen goes to sleep mode. I want the vibration continue even after the screen goes to sleep mode. Is there any ways to do this? Please help me. Thanks in

A foreground service gets killed and notification gets removed when app is swiped from recent apps

别来无恙 提交于 2020-01-22 20:11:47
问题 I have a foreground-service with notification. When the app is swiped away from recent apps tray, service gets killed and notification also gets removed. Here is the code for my service VoiceService.class : @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { showNotification(); Toast.makeText(this, "Service Started!", Toast.LENGTH_SHORT).show(); return START_STICKY; } private void showNotification() { new

RemoteServiceException: Bad notification for startForeground: java.util.ConcurrentModificationException

北慕城南 提交于 2020-01-22 09:37:34
问题 android.app.RemoteServiceException: Bad notification for startForeground: java.util.ConcurrentModificationException at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2204) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7523) at java.lang.reflect.Method.invoke(Method.java:-2) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal

RemoteServiceException: Bad notification for startForeground: java.util.ConcurrentModificationException

∥☆過路亽.° 提交于 2020-01-22 09:33:06
问题 android.app.RemoteServiceException: Bad notification for startForeground: java.util.ConcurrentModificationException at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2204) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7523) at java.lang.reflect.Method.invoke(Method.java:-2) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal

Best Practice to report user location continuously

给你一囗甜甜゛ 提交于 2020-01-20 15:33:09
问题 I'm designing an application where application in server side need to be continuously aware of user location. I'm thinking to create an Android service that run in the background and continuously query user location and send the result to an application in the backend server. However, I wonder if this is the best approach in terms of battery saving. For example, in iOS, there is something called "Significant-Change" to serve such purpose, does Android have similar thing. 回答1: I suggest to

Best Practice to report user location continuously

岁酱吖の 提交于 2020-01-20 15:16:22
问题 I'm designing an application where application in server side need to be continuously aware of user location. I'm thinking to create an Android service that run in the background and continuously query user location and send the result to an application in the backend server. However, I wonder if this is the best approach in terms of battery saving. For example, in iOS, there is something called "Significant-Change" to serve such purpose, does Android have similar thing. 回答1: I suggest to

Best Practice to report user location continuously

霸气de小男生 提交于 2020-01-20 15:16:06
问题 I'm designing an application where application in server side need to be continuously aware of user location. I'm thinking to create an Android service that run in the background and continuously query user location and send the result to an application in the backend server. However, I wonder if this is the best approach in terms of battery saving. For example, in iOS, there is something called "Significant-Change" to serve such purpose, does Android have similar thing. 回答1: I suggest to

Does calling stopService() stops all awaiting service intent

て烟熏妆下的殇ゞ 提交于 2020-01-17 06:51:43
问题 In my application, I'm starting a Service multiple times even when it's running. Its a service that is perpetually running. My question here is, when I call stopService() , will it stop the current running Service and ALSO clear the stack of the waiting intent? Because I want to be sure it is not running anymore. 回答1: I dont stop my Service , it is STICKY Service . When starting app i am controlling the service is running or not like : public static boolean isMyServiceRunning(Class<?>

Is there any way how to get data from push notification using FirebaseMessagingService in background?

十年热恋 提交于 2020-01-16 10:11:52
问题 I'm using FirebaseMessagingService for my push notifications. It is working as intented in app. onMessageReceived is called, I can get notification title and body + data payload and send reaction depends on payload data to my Activity using LocalBroadcastManager . But there is problem with background push notification. This will only show notification in background, but it is not created in onMessageReceived because this function cannot be called if app is in background. According to