Android: Alliance's Automatic Updates component

Source: Internet
Author: User
Tags final resource

A good and professional service can help developers save a lot of time. Starting with the project is also ready to do their own statistics, automatic Updates, as the use of the AU service increased time, gradually abandoned the idea, instead of studying how to use more fully, here to share the use of the automatic updating component experience.

A lack of res causes the problem that cannot be upgraded

As a result of lack of understanding, official website documents also useless reminder, just copy the SDK jar to the project, has not known whether the upgrade function has been achieved, the key is not to complain! Today again took out the test, listening to the Umengupdatelistener interface, found that the client has detected an update, but did not eject the updated dialog box, and then noticed the following log:

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

Although it doesn't have anything to do with Umeng, it updates the jar and then compiles the jar and looks at the code, checks the SDK, and finds that fewer copies of the resource files, and drawable, Layout, string, and things under Res, Copy into the project! Spit it out, it's ugly--# and then there's the following:

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Second, customize the Upgrade dialog box

/** version detection/private void checkversion () {Umengupdateagent.setupdateonlywifi (true);
        Umengupdateagent.setupdateautopopup (FALSE); Umengupdateagent.setupdatelistener (New Umengupdatelistener () {@Override public void onUpdate Returned (int updatestatus, updateresponse updateinfo) {if (UpdateStatus = 0 &&am P
                Updateinfo!= null) {Showupdatedialog (Updateinfo.path, Updateinfo.updatelog); //Case 0://has update//Case 1://has no update//Case 2:/None
    
        WiFi/Case 3://Time Out}});
    Umengupdateagent.update (this); } private void Showupdatedialog (final string downloadurl, final string message) {Alertdialog.builder upd
        Atealertdialog = new Alertdialog.builder (this);
        Updatealertdialog.seticon (R.drawable.app_icon); UpdateALertdialog.settitle (R.string.app_name);
        Updatealertdialog.setmessage (getString (r.string.update_hint, message));
                    Updatealertdialog.setnegativebutton (R.STRING.UPDATE_OK, New Dialoginterface.onclicklistener () { @Override public void OnClick (Dialoginterface dialog, int which) {D
                        Ialog.dismiss (); try {startactivity (the new Intent (Intent.action_view, Uri. PA
                        RSE (DownloadURL))); The catch (Exception ex) {}}}). Setpositivebutton (R.strin
        G.dialog_no, NULL);
    if (!isfinishing ()) updatealertdialog.show (); }

Third, the reference

Official website Document: http://dev.umeng.com/doc/document_update_android.html

End

Originally did not intend to use Umeng statistical components, mainly because the recent blog park to download the file (must log in), and then have to find other ways.

Author: cnblogs Peasant Uncle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.