Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何以编程方式访问运行服务屏幕?_Android_Service_Screen - Fatal编程技术网

Android 如何以编程方式访问运行服务屏幕?

Android 如何以编程方式访问运行服务屏幕?,android,service,screen,Android,Service,Screen,我无法找到访问运行服务屏幕的方法,我们通常使用以下方式访问该屏幕: Menu -> Setting -> Applications -> Running Services 根据一些程序员的说法,这是不可能的,甚至我在互联网上搜索了几天后也没有得到任何东西,但是像Advanced task killer和Advanced task manager这样的应用很少能通过他们的应用程序点击一下就轻松访问此屏幕。也许这就是你搜索的内容 android设置代码中没有这样的意图。检查下面的

我无法找到访问运行服务屏幕的方法,我们通常使用以下方式访问该屏幕:

Menu -> Setting -> Applications -> Running Services

根据一些程序员的说法,这是不可能的,甚至我在互联网上搜索了几天后也没有得到任何东西,但是像Advanced task killer和Advanced task manager这样的应用很少能通过他们的应用程序点击一下就轻松访问此屏幕。

也许这就是你搜索的内容


android设置代码中没有这样的意图。检查下面的代码

<activity android:name="RunningServices"
              android:label="@string/runningservices_settings_title"
              android:clearTaskOnLaunch="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.MONKEY" />
            <category android:name="android.intent.category.VOICE_LAUNCH" />
            <category android:name="com.android.settings.SHORTCUT" />
        </intent-filter>
    </activity>


正如Commonware在另一个线程中所说的,壁橱是用于管理应用程序的。你确定第三方应用程序能做到这一点吗。如果是,应用程序的名称是什么?我认为他们通过package manager获得运行的服务,然后创建一个类似的UI。

下面是这个问题的解决方案


可能是@Vinoth tahts的翻版,我想可能是他们获得了所有正在运行的服务,然后创建了一个类似于操作系统默认UI的UI。顺便说一句,这些应用程序的名称是Advanced Task Manager和Advanced Task Killer。@Vinoth我使用getRunningServices()获得了所有服务,并创建了与Running Services屏幕几乎相同的布局,但你能告诉我android是如何真正停止服务的,因为我尝试使用stopService()停止服务,但它似乎不起作用。你能在这方面帮助我吗???我一直在修改设置应用程序,所以我对这段代码有点了解。Android使用ForceStopAcakge API停止服务或活动。您需要将包名传递给此API。然而,有一个陷阱。您的应用需要像平台应用一样进行签名才能访问此API。您可以在此处找到代码-AOSP平台密钥和证书位于生成/目标文件夹中。但是不同的制造商会有不同的钥匙。您是否尝试在活动管理器中使用restartPackage()。虽然这个API被贬低了,但它仍然可以工作。这将基本上完成强制停止。在前往NDK之前,请尝试此API一次。您需要将“android.permission.RESTART_PACKAGES”添加到清单文件中。500内部服务器错误。解决方案应该在这里