2

每当活动管理器启动系统设置时,我都会尝试接收广播。

系统设置活动的意图过滤器是什么?

4

1 回答 1

0

No intent is broadcasted when System Settings are launched. But you can create a service and check the top activity in activity stack like that:

ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> processes = activityManager.getRunningTasks(1);
ComponentName componentInfo = processes.get(0).topActivity;
String className = componentInfo.getClassName();    
String packageName = componentInfo.getPackageName();
if(className.equalsIgnoreCase("com.android.settings.Settings"))
{
    // DO YOUR JOB HERE
}
于 2012-06-22T15:25:56.997 回答