[update] alliance of component Android

Recommended for you: Get network issues from WhatsUp Gold. Not end users.


Good and professional services to help developers to save a lot of time. Started as a project also prepare themselves to do their own statistical data, automatic updates, along with the League of friends service time increasing, gradually give up this idea, to study how to more fully, here to share with automatic update component experience.

The statement

Welcome to reprint, but please retain the original source of the article:)

Blog Park:

The farmer uncle:  

The text

A lack of res cannot be upgraded, cause problems

Due to the lack of understanding, official document is of no use to remind, simply copy the SDK jar to the project, don't know what has been upgrading function has been achieved, the key is not wrong! Out again today to test a bit, listen to the UmengUpdateListener interface, found that the client has detected the update, but update dialog pop up, then we noticed the following log:

W/ResourceType(7881): No known package when getting value for resource number 0xffffffff 

Although no display and Umeng have a relationship, or to update the jar, and reverse engineered the jar check code, and check the SDK, was found in a small copy of the resource file, res and drawable, layout, string and things, can be copied into the project! Tucao, ugly -- #, then there is the following:

Two, custom upgrade dialog

/** Version detection */

private void checkVersion() {



UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {


public void onUpdateReturned(int updateStatus,

UpdateResponse updateInfo) {

if (updateStatus == 0 && updateInfo != null) {

showUpdateDialog(updateInfo.path, updateInfo.updateLog);


// case 0: // has update

// case 1: // has no update

// case 2: // none wifi

// case 3: // time out





private void showUpdateDialog(final String downloadUrl, final String message) {

AlertDialog.Builder updateAlertDialog = new AlertDialog.Builder(this);



updateAlertDialog.setMessage(getString(R.string.update_hint, message));


new DialogInterface.OnClickListener() {


public void onClick(DialogInterface dialog, int which) {


try {

startActivity(new Intent(Intent.ACTION_VIEW, Uri


catch (Exception ex) {



}).setPositiveButton(R.string.dialog_no, null);

if (!isFinishing())



Three, reference

Official document:  


Originally did not intend to use the statistical component of Umeng, largely because of the recent blog download the file to the letters (must be logged in), then you will have to find other ways.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Angelia at November 14, 2013 - 12:47 AM