Android,创建 "non visible".apk
Android, create "non visible" .apk
我正在开发一个 Android 框架,它由一个在前台执行的主 .apk 和一组 "plug-ins" 组成,后者是可以下载并安装到设备中的 .apk默默。
该架构的主要目的是只有一个应用程序 运行 并且对用户可见,以及一组由主应用程序执行但不能直接执行的插件。
到目前为止,我发现发现我的设备上安装的可用软件包的一种方法是以下代码:
packageManager = getPackageManager();
applications = new ArrayList<>();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> availableActivities = packageManager.queryIntentActivities(intent,0);
但是此代码会检索所有公开了 CATEGORY_LAUNCHER 的包。
我的问题如下:
- 我可以创建一个安装后用户不可见的 apk 吗?所以它不提供单机启动的可能性?
- 如果我创建一个自定义 INTENT,我如何才能让主应用程序知道一个新的包被分组到新的 intent 中,并且已经安装在系统中?一种触发器,可能吗?
that can be downloaded and installed into the device silently
这是不可能的,除非在有根设备上或通过特殊的系统应用程序。否则,用户将参与安装您的插件。
Can I create an apk that when installed is not visible by the user? So it does not give the possibility to be launched as stand-alone?
如果您的意思是 LAUNCHER
<intent-filter>
,您可以拥有一个没有 activity 的应用程序。用户仍会在已安装应用程序列表和设置中的其他位置看到您的插件。
在使用此插件时,您还需要使用显式 Intent
(具有组件集的插件),以将其从停止状态中移出。在您使用显式 Intent
与应用程序的某些组件对话之前,插件中的任何内容都不会 运行(例如,清单注册的接收器)。
If I create a custom INTENT, how can I make the main application aware of a new package that is grouped into the new intent, has been installed in the system?
这不是一个有效的英语句子。我要解释它的意思:
How can I find out when the user installs a plugin?
您可以关注 ACTION_PACKAGE_ADDED
broadcasts 以了解何时安装了新应用。届时,您可以通过某种方式确定新安装的应用程序是否是您的插件。
您可以从 Manifest 文件中删除以下所需的 Activity。
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
我正在开发一个 Android 框架,它由一个在前台执行的主 .apk 和一组 "plug-ins" 组成,后者是可以下载并安装到设备中的 .apk默默。 该架构的主要目的是只有一个应用程序 运行 并且对用户可见,以及一组由主应用程序执行但不能直接执行的插件。
到目前为止,我发现发现我的设备上安装的可用软件包的一种方法是以下代码:
packageManager = getPackageManager();
applications = new ArrayList<>();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> availableActivities = packageManager.queryIntentActivities(intent,0);
但是此代码会检索所有公开了 CATEGORY_LAUNCHER 的包。 我的问题如下:
- 我可以创建一个安装后用户不可见的 apk 吗?所以它不提供单机启动的可能性?
- 如果我创建一个自定义 INTENT,我如何才能让主应用程序知道一个新的包被分组到新的 intent 中,并且已经安装在系统中?一种触发器,可能吗?
that can be downloaded and installed into the device silently
这是不可能的,除非在有根设备上或通过特殊的系统应用程序。否则,用户将参与安装您的插件。
Can I create an apk that when installed is not visible by the user? So it does not give the possibility to be launched as stand-alone?
如果您的意思是 LAUNCHER
<intent-filter>
,您可以拥有一个没有 activity 的应用程序。用户仍会在已安装应用程序列表和设置中的其他位置看到您的插件。
在使用此插件时,您还需要使用显式 Intent
(具有组件集的插件),以将其从停止状态中移出。在您使用显式 Intent
与应用程序的某些组件对话之前,插件中的任何内容都不会 运行(例如,清单注册的接收器)。
If I create a custom INTENT, how can I make the main application aware of a new package that is grouped into the new intent, has been installed in the system?
这不是一个有效的英语句子。我要解释它的意思:
How can I find out when the user installs a plugin?
您可以关注 ACTION_PACKAGE_ADDED
broadcasts 以了解何时安装了新应用。届时,您可以通过某种方式确定新安装的应用程序是否是您的插件。
您可以从 Manifest 文件中删除以下所需的 Activity。
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>