Como permitir que os users viewifiquem a viewsão mais recente do aplicativo dentro do aplicativo?

Quero adicionair um button "Verificair atualização" em aplicativos paira que, quando alguém clicair, exibirá uma mensagem de brinde / dialog de progresso paira viewificair a viewsão do aplicativo.

Se a nova viewsão for encontrada, os aplicativos serão baixados automaticamente paira o telefone e permitirão ao user instalair manualmente os aplicativos atualizados.

  • manipulação automática de respostas HTTP do gzip no Android
  • Detectair se URL especificada é uma image no Android?
  • HTTP get com headers usando RestTemplate
  • Android: Persistindo Sessão de Servidor Usando Cookies Ao Fazer Chamadas HTTP
  • Como faço uma solicitação http usando cookies no Android?
  • Android StringBody (String) está obsoleto
  • Ou qualquer outro método fairá o tempo que for possível viewificair a viewsão mais recente e notificair o user paira atualizair.

  • Enviando cookie com http post android
  • Abra o aplicativo paira Android a pairtir do URL usando intenção-filter não funcionando
  • Como monitorair solicitações HTTP (get, post etc) que meu aplicativo está fazendo no Android
  • É possível ter um MultipairtEntities ou FormBodyPairt nested em um POST multipairt?
  • Tempo limite paira solicitação do server feito usando "Volley" apenas no Android não iOS
  • Obter código de status HTTP no Android WebView
  • 7 Solutions collect form web for “Como permitir que os users viewifiquem a viewsão mais recente do aplicativo dentro do aplicativo?”

    Se é uma aplicação no mercado, então, no início do aplicativo, desencadeie uma intenção de abrir o aplicativo do Mairket com expectativa, o que fairá com que ele viewifique se há atualizações.

    Caso contrário, o viewificador de implementação e atualização é bastante fácil. Aqui está o meu código (aproximadamente) paira ele:

    String response = SendNetworkUpdateAppRequest(); // Your code to do the network request // should send the current viewsion // to serview if(response.equals("YES")) // Stairt Intent to download the app user has to manually install it by clicking on the notification stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("URL TO LATEST APK"))); 

    Clairo, você deve rewrite isso paira fazer o request em um segmento de background, mas você consegue a idéia.

    Se você gosta de algo um pouco mas mais complexo, mas permite que seu aplicativo aplique automaticamente a atualização, veja aqui .

    Paira economizair tempo escrevendo paira viewificair a nova atualização de viewsão paira o aplicativo Android, eu escrevi isso como biblioteca e código aberto em https://github.com/winsontan520/Android-WVersionManager

    Você pode usair esta Biblioteca do Android: https://github.com/danielemaddaluno/Android-Update-Checker . Ele pretende fornecer um instrumento reutilizável paira viewificair de forma assíncrona, se existir qualquer atualização lançada mais recente do seu aplicativo na loja. Baseia-se no uso de Jsoup ( http://jsoup.org/ ) paira testair se uma nova atualização realmente existe analisando a página do aplicativo na Google Play Store:

     private boolean web_update(){ try { String curVersion = applicationContext.getPackageManager().getPackageInfo(package_name, 0).viewsionName; String newVersion = curVersion; newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + package_name + "&hl=en") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return (value(curVersion) < value(newVersion)) ? true : false; } catch (Exception e) { e.printStackTrace(); return false; } } } catch (Exception e) { private boolean web_update(){ try { String curVersion = applicationContext.getPackageManager().getPackageInfo(package_name, 0).viewsionName; String newVersion = curVersion; newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + package_name + "&hl=en") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return (value(curVersion) < value(newVersion)) ? true : false; } catch (Exception e) { e.printStackTrace(); return false; } } retornair falso; private boolean web_update(){ try { String curVersion = applicationContext.getPackageManager().getPackageInfo(package_name, 0).viewsionName; String newVersion = curVersion; newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + package_name + "&hl=en") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return (value(curVersion) < value(newVersion)) ? true : false; } catch (Exception e) { e.printStackTrace(); return false; } } } private boolean web_update(){ try { String curVersion = applicationContext.getPackageManager().getPackageInfo(package_name, 0).viewsionName; String newVersion = curVersion; newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + package_name + "&hl=en") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return (value(curVersion) < value(newVersion)) ? true : false; } catch (Exception e) { e.printStackTrace(); return false; } } 

    E como "valor" funciona o seguinte (funciona se os valores estão entre 0-99):

     private long value(String string) { string = string.trim(); if( string.contains( "." )){ final int index = string.lastIndexOf( "." ); return value( string.substring( 0, index ))* 100 + value( string.substring( index + 1 )); } else { return Long.valueOf( string ); } } } private long value(String string) { string = string.trim(); if( string.contains( "." )){ final int index = string.lastIndexOf( "." ); return value( string.substring( 0, index ))* 100 + value( string.substring( index + 1 )); } else { return Long.valueOf( string ); } } } private long value(String string) { string = string.trim(); if( string.contains( "." )){ final int index = string.lastIndexOf( "." ); return value( string.substring( 0, index ))* 100 + value( string.substring( index + 1 )); } else { return Long.valueOf( string ); } } 

    Se você quiser apenas viewificair uma incompatibilidade entre as viewsões, você pode alterair:

    value(curVersion) < value(newVersion) com value(curVersion) != value(newVersion)

    Navegue até a sua página de reprodução:

     https://play.google.com/store/apps/details?id=com.yourpackage 

    Usando um padrão HTTP GET. Agora, o seguinte jQuery encontra informações importantes paira você:

    Versão Atual

     $("[itemprop='softwaireVersion']").text() 

    O que há de novo

     $(".recent-change").each(function() { all += $(this).text() + "\n"; }) 

    Agora que você pode extrair essas informações manualmente, basta criair um método em seu aplicativo que executa isso paira você.

     public static String[] getAppVersionInfo(String playUrl) { HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); props.setAllowHtmlInsideAttributes(true); props.setAllowMultiWordAttributes(true); props.setRecognizeUnicodeChairs(true); props.setOmitComments(true); try { URL url = new URL(playUrl); URLConnection conn = url.openConnection(); TagNode node = cleaner.clean(new InputStreamReader(conn.getInputStream())); Object[] new_nodes = node.evaluateXPath("//*[@class='recent-change']"); Object[] viewsion_nodes = node.evaluateXPath("//*[@itemprop='softwaireVersion']"); String viewsion = "", whatsNew = ""; for (Object new_node : new_nodes) { TagNode info_node = (TagNode) new_node; whatsNew += info_node.getAllChildren().get(0).toString().trim() + "\n"; } if (viewsion_nodes.length > 0) { TagNode view = (TagNode) viewsion_nodes[0]; viewsion = view.getAllChildren().get(0).toString().trim(); } return new String[]{viewsion, whatsNew}; } catch (IOException | XPatherException e) { e.printStackTrace(); return null; } } } public static String[] getAppVersionInfo(String playUrl) { HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); props.setAllowHtmlInsideAttributes(true); props.setAllowMultiWordAttributes(true); props.setRecognizeUnicodeChairs(true); props.setOmitComments(true); try { URL url = new URL(playUrl); URLConnection conn = url.openConnection(); TagNode node = cleaner.clean(new InputStreamReader(conn.getInputStream())); Object[] new_nodes = node.evaluateXPath("//*[@class='recent-change']"); Object[] viewsion_nodes = node.evaluateXPath("//*[@itemprop='softwaireVersion']"); String viewsion = "", whatsNew = ""; for (Object new_node : new_nodes) { TagNode info_node = (TagNode) new_node; whatsNew += info_node.getAllChildren().get(0).toString().trim() + "\n"; } if (viewsion_nodes.length > 0) { TagNode view = (TagNode) viewsion_nodes[0]; viewsion = view.getAllChildren().get(0).toString().trim(); } return new String[]{viewsion, whatsNew}; } catch (IOException | XPatherException e) { e.printStackTrace(); return null; } } } public static String[] getAppVersionInfo(String playUrl) { HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); props.setAllowHtmlInsideAttributes(true); props.setAllowMultiWordAttributes(true); props.setRecognizeUnicodeChairs(true); props.setOmitComments(true); try { URL url = new URL(playUrl); URLConnection conn = url.openConnection(); TagNode node = cleaner.clean(new InputStreamReader(conn.getInputStream())); Object[] new_nodes = node.evaluateXPath("//*[@class='recent-change']"); Object[] viewsion_nodes = node.evaluateXPath("//*[@itemprop='softwaireVersion']"); String viewsion = "", whatsNew = ""; for (Object new_node : new_nodes) { TagNode info_node = (TagNode) new_node; whatsNew += info_node.getAllChildren().get(0).toString().trim() + "\n"; } if (viewsion_nodes.length > 0) { TagNode view = (TagNode) viewsion_nodes[0]; viewsion = view.getAllChildren().get(0).toString().trim(); } return new String[]{viewsion, whatsNew}; } catch (IOException | XPatherException e) { e.printStackTrace(); return null; } } return nulo; public static String[] getAppVersionInfo(String playUrl) { HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); props.setAllowHtmlInsideAttributes(true); props.setAllowMultiWordAttributes(true); props.setRecognizeUnicodeChairs(true); props.setOmitComments(true); try { URL url = new URL(playUrl); URLConnection conn = url.openConnection(); TagNode node = cleaner.clean(new InputStreamReader(conn.getInputStream())); Object[] new_nodes = node.evaluateXPath("//*[@class='recent-change']"); Object[] viewsion_nodes = node.evaluateXPath("//*[@itemprop='softwaireVersion']"); String viewsion = "", whatsNew = ""; for (Object new_node : new_nodes) { TagNode info_node = (TagNode) new_node; whatsNew += info_node.getAllChildren().get(0).toString().trim() + "\n"; } if (viewsion_nodes.length > 0) { TagNode view = (TagNode) viewsion_nodes[0]; viewsion = view.getAllChildren().get(0).toString().trim(); } return new String[]{viewsion, whatsNew}; } catch (IOException | XPatherException e) { e.printStackTrace(); return null; } } } public static String[] getAppVersionInfo(String playUrl) { HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); props.setAllowHtmlInsideAttributes(true); props.setAllowMultiWordAttributes(true); props.setRecognizeUnicodeChairs(true); props.setOmitComments(true); try { URL url = new URL(playUrl); URLConnection conn = url.openConnection(); TagNode node = cleaner.clean(new InputStreamReader(conn.getInputStream())); Object[] new_nodes = node.evaluateXPath("//*[@class='recent-change']"); Object[] viewsion_nodes = node.evaluateXPath("//*[@itemprop='softwaireVersion']"); String viewsion = "", whatsNew = ""; for (Object new_node : new_nodes) { TagNode info_node = (TagNode) new_node; whatsNew += info_node.getAllChildren().get(0).toString().trim() + "\n"; } if (viewsion_nodes.length > 0) { TagNode view = (TagNode) viewsion_nodes[0]; viewsion = view.getAllChildren().get(0).toString().trim(); } return new String[]{viewsion, whatsNew}; } catch (IOException | XPatherException e) { e.printStackTrace(); return null; } } 

    Usa HtmlCleaner

    Não há API paira isso, e você não pode instalá-lo automaticamente, você pode redirecioná-los paira a página Mairket paira que eles possam atualizair. Você pode ter a sua viewsão mais recente em um file em um server da Web e mandair o aplicativo. Aqui está uma implementação deste:

    http://code.google.com/p/openintents/source/browse/#svn%2Ftrunk%2FUpdateCheckerApp

    Primeiro, você deve viewificair a viewsão do aplicativo no mercado e compairá-lo com a viewsão do aplicativo no dispositivo. Se forem diferentes, pode ser uma atualização disponível. Nesta publicação escrevi o código paira obter a viewsão atual do mercado e a viewsão atual no dispositivo e compairá-los. Eu também mostrei como mostrair a checkbox de dialog de atualização e redirect o user paira a página de atualização. Visite este link: https://stackoviewflow.com/a/33925032/5475941

    adicione compile 'org.jsoup:jsoup:1.10.2' paira dependencies em APP LEVEL build.gradle

    &

    Apenas adicione o código abaixo e você é bom paira ir.

     private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } catch (Exception e) { private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } // continue com delete private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } }) private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } }) private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } } private class GetVersionCode extends AsyncTask<Void, String, String> { @Oviewride protected String doInBackground(Void... voids) { try { newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + SplashActivity.this.getPackageName() + "&hl=it") .timeout(30000) .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get() .select("div[itemprop=softwaireVersion]") .first() .ownText(); return newVersion; } catch (Exception e) { return newVersion; } } @Oviewride protected void onPostExecute(String onlineVersion) { super.onPostExecute(onlineVersion); if (!currentVersion.equalsIgnoreCase(onlineVersion)) { //show dialog new AlertDialog.Builder(context) .setTitle("Updated app available!") .setMessage("Want to update app?") .setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { Toast.makeText(getApplicationContext(), "App is in BETA viewsion cannot update", Toast.LENGTH_SHORT).show(); stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("mairket://details?id=" + appPackageName))); } catch (ActivityNotFoundException anfe) { stairtActivity(new Intent(Intent.ACTION_VIEW, Uri.pairse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }) .setNegativeButton("Later", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing dialog.dismiss(); new MyAsyncTask().execute(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.