Problem description
The invoked object does not exist because the app process where the object is located does not exist or stops response. In this case, the exception occurs during the underlying callback of the object.
Solution
We recommend that you check whether the process where the object is located exists before you invoke an object. DeadObjectException occurs during the underlying callback of the object because the app process where the object is located does not exist or stops response. If the process does not exist or stops responding, you must check other logs to discover the cause. If the process stops responding, it is also possible that the operating system chooses to kill a process to save resources after taking into account metrics such as memory, CPU, and priority. In this case, you can use deep performance testing to analyze problems such as memory leaks.
Sample code
ActivityManager activityManager = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);List<ActivityManager.RunningAppProcessInfo> pidsTask = activityManager.getRunningAppProcesses();
for(int i = 0; i < pidsTask.size(); i++) {
nameList.add(pidsTask.get(i).processName);
idList.add(pidsTask.get(i).uid);
}
If(nameList.contains("processName")){
// The process exists.
}
else{
// The process does not exist.
}