bugly implement full-volume update of apps

Source: Internet
Author: User

Turn http://blog.csdn.net/qq_33689414/article/details/54911895
bugly implement full-volume update of apps

bugly Official Website documents

First, parameter configuration
    • Introduction of third-party libraries in Gradle under the app
‘com.tencent.bugly:crashreport_upgrade:latest.release‘
    • 1
    • Add the appropriate permissions in the Androidmanfiest.xml
<Uses-permissionAndroid:name="Android.permission.READ_PHONE_STATE"/><Uses-permissionandroid:name= "Android.permission.INTERNET"/><uses-permission android:name= "Android.permission.ACCESS_NETWORK_STATE"/>< uses-permission android:name= " Android.permission.ACCESS_WIFI_STATE "/><uses-permission" Span class= "Hljs-attribute" >android:name= "Android.permission.READ_LOGS"/><!--save resources to sd card--><uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>  

Registering Activity Components

<activity    android:name="com.tencent.bugly.beta.ui.BetaActivity"    android:theme="@android:style/Theme.Translucent" />

Add Obfuscation Rule

com.tencent.bugly.**-keep public class com.tencent.bugly.**{*;}
Second, the SDK initialization configuration

When initializing, you can set a number of parameters, as follows:

    /***** Beta Advanced Settings *****//** * True indicates that the app initiates an automatic initialization upgrade module;     False does not initialize automatically;     * If the developer is concerned that the SDK initialization affects the app startup speed, it can be set to False, * manually call Beta.init (Getapplicationcontext (), false) at some point later. */Beta.autoinit =True/** * True indicates that the upgrade is automatically checked during initialization;     False indicates that the upgrade is not automatically checked and requires a manual call to the Beta.checkupgrade () method; */Beta.autocheckupgrade =True/** * Set upgrade check cycle to 60s (the default check period is 0s), 60s SDK does not repeat the back-desk request policy); */Beta.upgradecheckperiod =60 *1000;/** * Set the startup delay to 1s (default delay of 3s), the app launches 1s after the initialization of the SDK, to avoid affecting the app startup speed; */Beta.initdelay =1 *1000;/** * Set the notification bar large icon, largeiconid the picture resources in the project; */Beta.largeiconid = R.mipmap.ic_launcher;/** * Set the status bar small icon, smalliconid the picture resource ID in the project; */Beta.smalliconid = R.mipmap.ic_launcher;/** * Set Update popup The default display of Banner,defaultbannerid is the image resource ID in the project; * This banner is displayed when the background configuration banner pull fails, and the default is not set to show "Loading"; */Beta.defaultbannerid = R.mipmap.ic_launcher;/** * Set the download for the SD card to save the directory for the update resources, * The subsequent update resources will be saved in this directory, you need to add write_external_storage permissions in manifest; */Beta.storagedir = Environment. Getexternalstoragepublicdirectory (Environment.directory_downloads); /** * confirmed pop-up windows will appear again when the app automatically checks for updates the next time it starts; */beta.showinterruptedstrategy = true; /** * Only allow to display the update pop-up on the mainactivity, other activity does not show the pop-up window; No default all activity can display pop-up windows; */Beta.canShowUpgradeActs.add ( Mainactivity. class); /***** bugly Advanced settings *****/buglystrategy strategy = new Buglystrategy (); /** * Set APP channel number */Strategy.setappchannel (App_channel); /***** Unified Initialization of bugly products, including beta *****/bugly.init (this, app_id, true, strategy);      

    • Here for brevity, it's easy to set up
public class App extends Application { @Override public void onCreate() { super.onCreate(); Beta.autoCheckUpgrade = false;//设置不自动检查 Bugly.init(getApplicationContext(), "cddc41def5", false); }}
    • Use in the Mainactivity
PublicClassmainactivity extends  appcompatactivity { @Override protected void oncreate (Bundle savedinstancestate) { Super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); TextView TV = (TextView) Findviewbyid (r.id.tv); Tv.settext ( "current version number Versionname is:" + buildconfig.version_name); Button btn = (button) Findviewbyid (R.ID.BTN); Btn.setonclicklistener (new View.onclicklistener () {@ Override public void onClick (View V ) {Beta.checkupgrade (); //check version number}}); }}

Bugly implementing full app updates

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.