android-service-binding

How to auto restart a service when killed?

末鹿安然 提交于 2019-11-29 12:49:47
I have already red many posts about the subject, some of these works, but only on some devices. For example it works on my Nexus 4, Nexus 5 with cyaogenmod, but not on my Xiaomi Mi2s (jelly beam 4.1.1) I tried setting it sticky, using alarm, and broadcast receiver on destroy. But neither of them worked out. When I kill the application it never wake up again. But on the same device Whatsapp works perfectly, and even if I kill it, it wake up again.. Is there any way to do it without use GCM? Some of the link I already looked up: How to restart a killed service automatically? Service that

How do I detect skype/telegram/whatsapp calls when my messenger app is in a call or wants to make a call?

柔情痞子 提交于 2019-11-29 07:54:36
I am wondering if there is a way I can detect a skype call/telegram/whatsapp/fb messenger call etc in progress or incoming call etc just like the regular phone call with telephony manager/listener? I would like to have some kind of mechanism that detects an ongoing /incoming etc call from skype/telegram etc for my app. I came across this solution : Call Detection for skype in android but not sure if it'll work for all generic messenger apps. Is there a hack or any kind of listener I can implement on my side that allows me to detect these? Any ideas would be awesome. Thanks! You can use the

How to communicate between Firebase Messaging Service and Activity? Android

六眼飞鱼酱① 提交于 2019-11-29 02:17:49
问题 I know the question about how to communicate between a service and an activity has been answered many times but I also want my own way of doing this to be reviewed and to know if its an acceptable and the right way to do this and what are the drawbacks of how I handled it. First I will state the problem statement with as much detail as I can. I have to build an app where I am using Firebase Messaging Service to communicate between two devices. Let's say its an Uber like system. One app is for

Android java.lang.IllegalArgumentException: Service not registered

僤鯓⒐⒋嵵緔 提交于 2019-11-28 20:54:24
问题 I have a setup that looks something like this: class MyFragment implements SomeEventListener { Application mAppContext; boolean mBound; boolean mDidCallUnbind; MyIBinder mBinder; ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { mBound = true; mBinder = (MyIBinder) service; mBinder.getThings();... } @Override public void onServiceDisconnected(ComponentName name) { mDidCallUnbind = false; mBound = false;

How to auto restart a service when killed?

最后都变了- 提交于 2019-11-28 06:12:49
问题 I have already red many posts about the subject, some of these works, but only on some devices. For example it works on my Nexus 4, Nexus 5 with cyaogenmod, but not on my Xiaomi Mi2s (jelly beam 4.1.1) I tried setting it sticky, using alarm, and broadcast receiver on destroy. But neither of them worked out. When I kill the application it never wake up again. But on the same device Whatsapp works perfectly, and even if I kill it, it wake up again.. Is there any way to do it without use GCM?

Service: onTaskRemoved not called if started with bindService

蹲街弑〆低调 提交于 2019-11-27 23:11:58
问题 I have a Service in which the onTaskRemoved() method has been implemented. When the service is started with startService() the function onTaskRemoved() is called when the app is removed from the recent-apps-list by swipe. But if the service is started with bindService() , then onTaskRemoved() never called. How can I make the Service call onTaskRemoved() when app removed from recent-apps-list by swipe after it has been started with bindService() ? Android calls the following lifecycle methods

Getting java.lang.ClassCastException: android.os.BinderProxy every time i declare and run two services

痞子三分冷 提交于 2019-11-27 12:29:54
问题 I am encountering following binder.proxy exception every time i declare and run two services. One service runs in different Process(Private to app) and another service runs in same process as My Application is running in(Default App Process) with a Binder Implementation. AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.service.check" android:versionCode="1" android:versionName="1.0" > <uses-sdk

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

给你一囗甜甜゛ 提交于 2019-11-27 12:13:31
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. package com.packr.services; import android.app.AlarmManager; import android.app.PendingIntent; import android