public
class checkversionasynctask extends asynctask
@override
protected boolean doinbackground(string... params)
content += line;}/*
*/if (currentversion.compareto(oldversion) > 0)
result = true;
log.v("ids", content);
} catch (clientprotocolexception e) catch (ioexception e) finally
if (client != null)
} catch (ioexception e)
}return result;
}@override
protected
void
onpostexecute(boolean result)
}).setnegativebutton("cancel", new dialoginte***ce.onclicklistener()
}).setpositivebutton("update", new dialoginte***ce.onclicklistener()
}).create().show();}}
private
void
string packagename = context.getpackagename();
intent intent = new intent(intent.action_view);
intent.setdata(uri.parse("market://details?id="+packagename));
context.startactivity(intent);
}}
private
void
string packagename = context.getpackagename();
intent intent = new intent(intent.action_view);
intent.setdata(uri.parse("market://details?id="+packagename));
context.startactivity(intent);
}
intent.setdata(uri.parse(「market://details?id=」+packagename));這就是解決鏈結的關鍵,為什麼這麼做就不多說了。
前面已經把方法都現實了,剩下的就是呼叫了,我們可以在任意地方呼叫如下方法獲取版本比較,**如下:
好,重要的部分都講完啦,over~!!!private
void
try catch (namenotfoundexception e)
}
android 上架至 google play 版本更新檢查
iOS 版本更新
通常的做法是在自己的伺服器上記錄最新版本號,從ios客戶端請求,與本地版本號比較,不同則提示更新。這種做法簡單,缺點是需要單獨的伺服器支援。html view plain copy nsstring version nsurl urlid your versionrequest asiformdat...
ios版本更新
在我們使用應用時,一開啟應用,如果此應用有新的版本,常常能在應用中給出提示,是否要更新此應用。所以,我們就來看看,版本更新是如何實現的。蘋果給了我們乙個介面,能根據應用id請求一些關於應用的資訊。我們可以根據返回的資訊,來判斷版本是否和應用的版本一致,如果不一致,那麼就出現新的版本了。這時,就需要向...
更新python版本
wget 解壓檔案 test localhost tar zxvf python 2.7.11.tar.tgz test localhost cd python 2.7.11 test localhost python 2.7.11 su 口令 root localhost python 2.7.1...