将多个应用程序分组在应用程序启动器中的同一图标下
我想将多个应用程序分组在应用程序启动器中的同一图标下。 例如,5 个应用程序每个显示 1 个不同的图像。但这 5 个应用程序应该在 Android 市场上作为单独的应用程序出现,因此它们需要具有不同的包名称。
但不同的包名称意味着在 Android 设备上它们将在应用程序启动器中显示为 5 个独立的应用程序,这是我试图避免的。
我发现的最接近的解决方案是监听 PACKAGE_ADDED
广播事件,每次在设备上安装这 5 个应用程序中的另一个应用程序时,所有已安装的应用程序都会调用 setApplicationEnabledSetting
从 PackageManager
隐藏它们的图标并让刚刚安装的应用程序来处理事情。 但只有重新启动设备后,图标才会隐藏。
有没有办法强制应用程序启动器在运行时刷新? 或者还有其他方法可以实现我的目标吗? 我已经没有选择了。谢谢!
I want to group multiple apps under the same icon in the application launcher.
For example, 5 apps each displaying 1 different image. But those 5 apps should appear as separate apps on the Android market, therefore they need to have different package name.
But different package name, means that on the Android device they will appear as 5 separate apps in the application launcher, which I am trying to avoid.
The closest solution that I found is to listen for PACKAGE_ADDED
broadcast event, and every time another app from those 5 are installed on the device, all the already installed apps would call setApplicationEnabledSetting
from PackageManager
to hide their icons and let the app that was just installed to handle things.
But the icons are hidden only after rebooting the device.
Is there a way to force the application launcher to refresh at runtime?
Or is there any other way to solve my goal?
I am running out of options. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Miha,
如果有一个主应用程序,其他 4 个是附加程序(即未显示在启动器中)呢?这样,您将只有一个启动器图标,其他应用程序将从主应用程序启动。通过检查是否安装了其他应用程序,您可以相应地调整按钮/视图。
据我所知,没有办法强制启动器刷新。但是,您可以按照您所描述的方式实现您的应用程序 - 当我安装新应用程序时,让每个应用程序隐藏其图标。不过,用户会收到应用程序未安装错误,这可能不是您想要的。
就我个人而言,我使用第一种方法:拥有一个主键盘,然后安装附加组件,然后可以从主应用程序加载附加组件。
希望这有帮助。
Miha,
What about having one main application, with the other 4 being add-ons (i.e., not shown in the launcher)? You would then have only one launcher icon, and the other applications would be started from the main app. By checking whether the other apps were installed, you could adjust your buttons/views accordingly.
As far as I know, there is no way to force the launcher to refresh. However, you could implement your applications as you described -- having each app hide it's icon when I new one is installed. The user would get an application not installed error though, which is probably not something you want.
Personally, I used the first method: have a main keyboard and then install add-ons which can then be loaded from the main app.
Hope this helps.