I have a question about Android app 'Smart app protector'.

Asked 2 years ago, Updated 2 years ago, 28 views

Hello, I am a college student studying Android. While studying Android, I found a kind of lock app called smart app protector This app sets up the app you designated and then turns on the set app, causing an error window to appear You will be forced to exit. I wonder if A's app can force B's app to shut down! If possible, I wonder what kind of technology it was implemented with!

android

2022-09-21 14:19

1 Answers

I'm not sure how to shut down the app, but here's the code snippet I'm trying to shut down.

First, grant the following permissions to the manifest: (Since ProYO version)

<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />

The following code is required to shut down the program:

ActivityManager manager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
manager.killBackgroundProcesses ("package name of app");

However, unlike in the past, today's Android does not necessarily shut down the app because it makes requests like that. Depending on the state of the process, which is an Android process management strategy, only non-critical processes are selectively terminated.

But if you're trying to force him to die... Get the pid of the running app, send the KILL signal first and try it. It's not a good way, but it's a little more likely to end.

android.os.Process.sendSignal(pid, android.os.Process.SIGNAL_KILL);

Refer to the Android development documentation (http://developer.android.com/reference/android/app/ActivityManager.html#killBackgroundProcesses(java.lang.String))


2022-09-21 14:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.