从其他应用 android 更改 activity
Changing activity from other app android
我想阻止某些程序的打开。
示例:我有一个程序 (A),其中包含所有配置(一把钥匙,要锁定的程序列表)。
激活 (A) 时,您打开一个程序 (B)(android 菜单中的短屏幕),如果它在锁定程序列表中,而不是打开它,(A) 应该是首先打开。我的意图是询问我的密钥 (A) 是否允许,然后打开预期的程序 (B)。
示例程序here。
提示:应用程序 (A) 如何查看正在打开的程序 (B) 并将其替换为我的意图或片段。
P.S。抱歉我的英语不好。
我用服务解决了这个问题
public class RepeatClass extends Service {
private static final String TAG = "ServiceTag";
private boolean isRunning = false;
@Override
public void onCreate() {
Log.i(TAG, "Service onCreate");
isRunning = true;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, "Service onStartCommand");
//Creating new thread for my service
//Always write your long running tasks in a separate thread, to avoid ANR
new Thread(new Runnable() {
@Override
public void run() {
//Your logic that service will perform will be placed here
//In this example we are just looping and waits for 1000 milliseconds in each loop.
while (true) {try {
Thread.sleep(1000);
//Detect openning programm with activeManager and open normal intent
}
catch(Exception e){
}
}
}
}
我想阻止某些程序的打开。
示例:我有一个程序 (A),其中包含所有配置(一把钥匙,要锁定的程序列表)。
激活 (A) 时,您打开一个程序 (B)(android 菜单中的短屏幕),如果它在锁定程序列表中,而不是打开它,(A) 应该是首先打开。我的意图是询问我的密钥 (A) 是否允许,然后打开预期的程序 (B)。
示例程序here。
提示:应用程序 (A) 如何查看正在打开的程序 (B) 并将其替换为我的意图或片段。
P.S。抱歉我的英语不好。
我用服务解决了这个问题
public class RepeatClass extends Service {
private static final String TAG = "ServiceTag";
private boolean isRunning = false;
@Override
public void onCreate() {
Log.i(TAG, "Service onCreate");
isRunning = true;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, "Service onStartCommand");
//Creating new thread for my service
//Always write your long running tasks in a separate thread, to avoid ANR
new Thread(new Runnable() {
@Override
public void run() {
//Your logic that service will perform will be placed here
//In this example we are just looping and waits for 1000 milliseconds in each loop.
while (true) {try {
Thread.sleep(1000);
//Detect openning programm with activeManager and open normal intent
}
catch(Exception e){
}
}
}
}