Skip to content

Commit 06e6b30

Browse files
authored
Android 8.0 onBindingDied()
1 parent 6d840a2 commit 06e6b30

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hellodaemon/src/main/java/com/xdandroid/hellodaemon/DaemonEnv.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,22 @@ public static void startServiceMayBind(@NonNull final Class<? extends Service> s
3939
ServiceConnection bound = BIND_STATE_MAP.get(serviceClass);
4040
if (bound == null) sApp.bindService(i, new ServiceConnection() {
4141
@Override
42-
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
42+
public void onServiceConnected(ComponentName name, IBinder service) {
4343
BIND_STATE_MAP.put(serviceClass, this);
4444
}
4545

4646
@Override
47-
public void onServiceDisconnected(ComponentName componentName) {
47+
public void onServiceDisconnected(ComponentName name) {
4848
BIND_STATE_MAP.remove(serviceClass);
4949
startServiceSafely(i);
5050
if (!sInitialized) return;
5151
sApp.bindService(i, this, Context.BIND_AUTO_CREATE);
5252
}
53+
54+
@Override
55+
public void onBindingDied(ComponentName name) {
56+
onServiceDisconnected(name);
57+
}
5358
}, Context.BIND_AUTO_CREATE);
5459
}
5560

0 commit comments

Comments
 (0)