2015-11-04 75 views
3

在我的Android应用程序,我用这个代码卸载应用:“你想卸载的应用”是否可以自定义或更改android应用程序卸载消息?

Intent intent = new Intent(Intent.ACTION_DELETE); 
intent.setData(Uri.parse("package:com.ubercab")); 
startActivity(intent); 

虽然它工作正常,是否有可能改变信息自定义的东西?

我可以在这个卸载之前有另一个对话框,但我只是想知道这个文本是否可以自定义。

enter image description here

回答

1

不,您无法自定义卸载消息。

正如你可以在消息从应用程序的资源采取的PackageInstaller的UninstallerActivity看到,它不是定制:

UserManager userManager = UserManager.get(getActivity()); 
if (dialogInfo.allUsers && userManager.getUserCount() >= 2) { 
    messageBuilder.append(getString(R.string.uninstall_application_text_all_users)); 
} else if (!dialogInfo.user.equals(android.os.Process.myUserHandle())) { 
    UserInfo userInfo = userManager.getUserInfo(dialogInfo.user.getIdentifier()); 
    messageBuilder.append(
      getString(R.string.uninstall_application_text_user, userInfo.name)); 
} else { 
    messageBuilder.append(getString(R.string.uninstall_application_text)); 
} 

这些都是在string.xml提供的字符串:

<string name="uninstall_application_text">Do you want to uninstall this app?</string> 
<string name="uninstall_application_text_all_users">Do you want to uninstall this app for <b>all</b> users? The application and its data will be removed from <b>all</b> users on the device.</string> 
<string name="uninstall_application_text_user">Do you want to uninstall this app for the user <xliff:g id="username">%1$s</xliff:g>?</string> 
+0

按照你所说的,如果应用程序是我自己的应用程序,它应该是可编辑的,我可以设置字符串的值? – user1429322

+0

是的,如果你创建你的Package Installer版本,你可以自定义字符串 –

1

不,你不能改变第三方代码显示的文本,包括系统的对话是这样的。

相关问题