简体   繁体   English

如何将应用程序设为默认系统启动器?

[英]How to make app as a default system launcher?

I have developed the launcher application, for the first time when I installed it on device android system pop up chooser dialogue with two options ie Always & Just once.我已经开发了启动器应用程序,当我第一次将它安装在设备 android 系统上时,会弹出带有两个选项的选择器对话框,即始终和仅一次。 I selected "Always" now my app becomes default launcher but issue is when I update the app, the system pop up the same chooser dialogue again, I don't want to show that pop up.我选择了“始终”,现在我的应用程序成为默认启动器,但问题是当我更新应用程序时,系统再次弹出相同的选择器对话框,我不想显示该弹出窗口。 How to make the app as a default system launcher?如何将应用程序设为默认系统启动器? To achieve this, Do I need to create system level app?为此,我是否需要创建系统级应用程序?

I have used following permission to make the app a launcher我已使用以下权限使应用程序成为启动器

<intent-filter>
 <action android:name="android.intent.action.MAIN" />               
 <category android:name="android.intent.category.HOME" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.MONKEY" />
</intent-filter>

It is not possible to change the user preferences.无法更改用户首选项。 Google does not allow developer to change user preferences. Google 不允许开发者更改用户偏好。

A workaround may be useful, you can check for if your application is default launcher through a service and then prompt user to choose your application as default.解决方法可能很有用,您可以通过服务检查您的应用程序是否为默认启动器,然后提示用户选择您的应用程序作为默认启动器。

You can find how to check if your application is the default launcher from here (tried this one, it works for me) or here您可以从这里找到如何检查您的应用程序是否是默认启动器(试过这个,它对我有用)或这里

Then you can prompt the user to select your application if it is not the default launcher.然后,如果它不是默认启动器,您可以提示用户选择您的应用程序。 A workaround to do so is given here .此处提供一种解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM