I made an Android 10 app which has a background service which runs all the time. I added a feature to remotely call a phone number. When the corresponding activity is openend, the background service can open the call activity and starts a call. Problem is, when the activity is closed, the call activity does not show up, no exception, nothing.
Manifest:
<uses-permission android:name="android.permission.CALL_PHONE" />
Activity:
permissions.add(Manifest.permission.CALL_PHONE);
Permission is asked on activity open and granted.
Service:
String nr = cmd.substring(Constant.CMD_CALL.length());
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + nr));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(intent);
logcat:
2022-01-29 11:39:35.569 930-3493/? I/ActivityTaskManager: START u0 {act=android.intent.action.CALL dat=tel:xxxxxxxxxxx flg=0x10000000 cmp=com.android.server.telecom/.components.UserCallActivity} from uid 10523
2022-01-29 11:39:35.573 930-3493/? W/ActivityTaskManager: Background activity start [callingPackage: com.miachn.familyt3; callingUid: 10523; isCallingUidForeground: false; isCallingUidPersistentSystemProcess: false; realCallingUid: 10523; isRealCallingUidForeground: false; isRealCallingUidPersistentSystemProcess: false; originatingPendingIntent: null; isBgStartWhitelisted: false; intent: Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxx flg=0x10000000 cmp=com.android.server.telecom/.components.UserCallActivity }; callerApp: ProcessRecord{1bb7752 5331:com.miachn.familyt3/u0a523}]
EDIT: I have an app installed called cerberus, its an anti theft app. With this one calling from the background works, so there must be a way to do a call from background. It is set as device admin, could this be needed?
Any help would be appreciated.
thanks regards Erich