Android 如何从我的应用程序以编程方式打开带有更新页面的playstore应用程序
我正在比较我在谷歌play store上的应用程序版本和play store中的应用程序版本。所以,每当上传新版本的应用程序时,它都会向用户显示更新应用程序的对话框,但当我单击对话框中的“更新按钮”时,它会打开带有“打开”和“卸载”按钮的play store,而不是“更新”和“卸载”按钮 所以,请告诉我当新版本上传到play store时,如何使用“更新”和“卸载”按钮打开play store应用程序Android 如何从我的应用程序以编程方式打开带有更新页面的playstore应用程序,android,google-play,Android,Google Play,我正在比较我在谷歌play store上的应用程序版本和play store中的应用程序版本。所以,每当上传新版本的应用程序时,它都会向用户显示更新应用程序的对话框,但当我单击对话框中的“更新按钮”时,它会打开带有“打开”和“卸载”按钮的play store,而不是“更新”和“卸载”按钮 所以,请告诉我当新版本上传到play store时,如何使用“更新”和“卸载”按钮打开play store应用程序 AlertDialog.Builder dialogUpdate= new AlertDia
AlertDialog.Builder dialogUpdate= new AlertDialog.Builder(Main_list_Activity.this,AlertDialog.THEME_TRADITIONAL).setTitle("New Version Available")
.setIcon(getResources()
.getDrawable(android.R.drawable.stat_sys_download))
.setMessage("New version of app is available. Update your app")
.setCancelable(false)
.setNeutralButton("UPDATE", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
try {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id="+getPackageName())));
} catch (ActivityNotFoundException e) {
// TODO: handle exception
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName())));
}
}
});
AlertDialog updatedialog = dialogUpdate.create();
updatedialog.show();
这是我开游戏商店的密码
AlertDialog.Builder dialogUpdate= new AlertDialog.Builder(Main_list_Activity.this,AlertDialog.THEME_TRADITIONAL).setTitle("New Version Available")
.setIcon(getResources()
.getDrawable(android.R.drawable.stat_sys_download))
.setMessage("New version of app is available. Update your app")
.setCancelable(false)
.setNeutralButton("UPDATE", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
try {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id="+getPackageName())));
} catch (ActivityNotFoundException e) {
// TODO: handle exception
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName())));
}
}
});
AlertDialog updatedialog = dialogUpdate.create();
updatedialog.show();
谷歌没有提供任何api来获取最新版本的应用程序代码。 谷歌没有为此提供任何API 不过,您可以在playstore()的web版本上发出http请求 要发出请求,可以使用DefaultHttpClient 获得页面内容后,您应该对其进行解析(jsoup是一个很好的解决方案)并搜索:
<div class="content" itemprop="softwareVersion"> 2.2.0 </div>
对于HTML解析部分,请看这里
请记住,每个人不会同时看到新版本。传播可能需要时间(可能是因为缓存)。请访问此链接,它可能会帮助您了解所需内容。如果它符合您的需要/要求,请点击此线程。我使用了相同的功能,并且在触发新版本时打开一个对话框,但当我在对话框中单击“更新”按钮时,它会打开“播放商店”,而我没有在“播放商店”中获得“更新”按钮,这是有问题的,所以您能告诉我如何在播放中获得“更新”按钮吗商店。?]如果已更新可用,则更新按钮可见如果不可用,则更新按钮不可用我尚未更新我的应用程序,即使我已检查我的应用程序版本和play store上的应用程序关闭版本,两者都不同,但仍未获得更新按钮。