public class UpdateNotification{  private static HashMap getLatestVersionData(String paramString)  {    HashMap localHashMap = new HashMap();    String str = "http://xxxxx/service_check_version.do?appCode=" + paramString;    DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient();    try    {      HttpResponse localHttpResponse = localDefaultHttpClient.execute(new HttpGet(str));      if (localHttpResponse.getStatusLine().getStatusCode() == 200)      {        ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();        localHttpResponse.getEntity().writeTo(localByteArrayOutputStream);        localByteArrayOutputStream.close();        JSONObject localJSONObject = new JSONObject(localByteArrayOutputStream.toString());        localHashMap.put("versionCode", localJSONObject.getString("versionCode"));        localHashMap.put("versionManageOption", localJSONObject.getString("versionManageOption"));      }      return localHashMap;    }    catch (ClientProtocolException localClientProtocolException)    {      Log.i("SERVER_ACCESS_ERROR", localClientProtocolException.getMessage());    }    catch (IOException localIOException)    {      Log.i("SERVER_ACCESS_ERROR", localIOException.getMessage());    }    catch (JSONException localJSONException)    {      Log.i("SERVER_ACCESS_ERROR", localJSONException.getMessage());    }  }  public static void showUpdateDialogIfNecessary(String paramString, Context paramContext)  {    try    {      new Thread(new Runnable(paramString, paramContext)      {        public void run()        {          HashMap localHashMap = UpdateNotification.access$0(UpdateNotification.this);          if ((!localHashMap.containsKey("versionCode")) || (!localHashMap.containsKey("versionManageOption")) || (localHashMap.get("versionCode") == null) || (((String)localHashMap.get("versionCode")).equals("")))            return;          try          {            int i = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionCode;            int j = Integer.parseInt((String)localHashMap.get("versionCode"));            String str = (String)localHashMap.get("versionManageOption");            if (j <= i)              return;            if (!str.equals("required"))              new AlertDialog.Builder(this).setIcon(R.id.icon).setTitle("New update available!").setPositiveButton("Update Now", new DialogInterface.OnClickListener(this.val$context)              {                public void onClick(DialogInterface paramDialogInterface, int paramInt)                {                  Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + this.getPackageName()));                  .startActivity(localIntent);                }              }).setNegativeButton("Later", new DialogInterface.OnClickListener()              {                public void onClick(DialogInterface paramDialogInterface, int paramInt)                {                }              }).show();            else              new AlertDialog.Builder(this).setIcon(R.id.icon).setTitle("New update available!").setPositiveButton("Update Now", new DialogInterface.OnClickListener(this.val$context)              {                public void onClick(DialogInterface paramDialogInterface, int paramInt)                {                  Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + this.getPackageName()));                  this.startActivity(localIntent);                }              }).show();          }          catch (PackageManager.NameNotFoundException localNameNotFoundException)          {            Log.i("VERSION_ACQUISITION_ERROR", localNameNotFoundException.getMessage());          }        }      }).start();      return;    }    catch (Exception localException)    {    }  }}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android中OpenGL使用Matrix.rotateM的困
  2. [Android] 利用java反射调用隐藏Api
  3. android 各版本区别
  4. 2018 Android 文章合集 200+ 篇
  5. 安卓基础知识总结
  6. Android 中几种更新UI界面的方法
  7. Android View视图绘制
  8. android之eclipse下查看android系统源代
  9. (android:windowIsTranslucent)影响(andr
  10. Android(安卓)init进程启动过程分析