检测该应用程序是否仍以编程方式在Google Play商店中仍在运行 [英] Detect If The App Is Still Live On Google Play Store Programmatically
本文介绍了检测该应用程序是否仍以编程方式在Google Play商店中仍在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以检查该应用是否仍在Google Play上直播(如果不显示吐司或活动)?
Is There a way to check if the app is still live on Google play , if not show toast or an activity ?
推荐答案
在按钮上单击以执行此任务(并更改您的应用ID,以测试您的情况)
On your button click execute this task (and change app id with your, to test your case)
new AsyncTask<Void, Boolean, Boolean>() {
@Override
protected Boolean doInBackground(Void... voids) {
boolean b = isAppLiveOnPlayStore("com.yourapp.id");
return b;
}
@Override
protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
if(aBoolean){
Toast.makeText(MainActivity.this, "App is Live", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(MainActivity.this, "App is not Live", Toast.LENGTH_SHORT).show();
}
}
}.execute();
public boolean isAppLiveOnPlayStore(String appid) {
try {
HttpURLConnection conn = (HttpURLConnection) (new URL("https://play.google.com/store/apps/details?id="+appid))
.openConnection();
conn.setUseCaches(false);
conn.connect();
int status = conn.getResponseCode();
conn.disconnect();
return status==200;
} catch (Exception e) {
Log.e("isAppLiveOnPlayStore", e.toString());
}
return false;
}
这篇关于检测该应用程序是否仍以编程方式在Google Play商店中仍在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文