android - 在其他应用程序编写的服务中获取任何应用程序的前台 Activity

标签 android android-intent android-activity service intentservice

我想要的是我需要对前台任何应用程序的当前 Activity 的引用。

基本上我已经编写了一个服务,我想获得对该服务中“当前”前台 Activity 的引用。 “当前”是指除了启动该服务的应用程序 Activity 之外的任何应用程序 Activity 。

最佳答案

What I want is that I need the reference to the current Activity of ANY application that is on the foreground.

那是不可能的。其他应用程序在其他进程中运行;您无权访问那些进程中的 Java 对象,例如 Activity 实例。

关于android - 在其他应用程序编写的服务中获取任何应用程序的前台 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30760852/

相关文章:

android - 如何完成销毁的 Activity

android - SharedPrefs 在设置 Android 应用程序的区域设置后重置

android - 在 ImageView 上设置图像不起作用 - Android

android - all-proto-files-under 不适用于 android.mk

android - 使用android Intent 如何在父亲和 Intent h之间传递参数

android - 在 Activity 之间传递类的实例

android - 背景不会在多行 TextView 上换行

android - 如何获取当前fragment的ID?

android - 1 MB .txt 文件中有多少个字符?

android - 使用已安装的文件编辑器(如果有)编辑纯文本文件的 Intent