Android Phone Defender--click the rewind button during installation

Source: Internet
Author: User
Tags rewind

This article address:, reprint please indicate source address.

In the Version Upgrade dialog box before the phone defender:

Some users do not want to update, do not click "later", but choose to click the Fallback button, then the logic should be to let the user into the home interface instead of the splash interface. So you need to add code logic to control and add the following code:

        Builder.setoncancellistener (new  Oncancellistener () {            @Override            publicvoid  OnCancel (Dialoginterface Dialog) {                // Even if the user clicks Cancel, they need to go to the main application screen                 Enterhome ();                Dialog.dismiss ();            }        });

When you click "Update Now", you will be prompted to install the activity interface of the new app.

At this point, if you click "Cancel", it will go back to the splash interface, obviously not what we want to see, here is the intention is to jump to Homeactivity, as follows:

To achieve this, simply change the startactivity to Startactivityforresult

    /*** Install the corresponding APK *@paramFile Installation files*/    protected voidinstallapk (file file) {//System Application interface, source code, install APK entranceIntent Intent =NewIntent (); Intent.setaction ("Android.intent.action.VIEW"); Intent.addcategory ("Android.intent.category.DEFAULT"); Intent.setdataandtype (uri.fromfile (file),"Application/"); //startactivity (intent);Startactivityforresult (Intent, 0); }        //the method that returns the result call after an activity is opened@Overrideprotected voidOnactivityresult (intRequestcode,intResultCode, Intent data)        {enterhome (); Super. Onactivityresult (Requestcode, ResultCode, data); }

Android Phone Defender--click the rewind button during installation

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: 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.