百度自动更新
百度更新四种方式
默认UI(弹窗,一般采用此方式):
BDAutoUpdateSDK.uiUpdateAction(this, new MyUICheckUpdateCallback());
静默更新:
BDAutoUpdateSDK.silenceUpdateAction(this);
百度助手更新:
BDAutoUpdateSDK.asUpdateAction(this, new MyUICheckUpdateCallback());
自定义UI更新:
BDAutoUpdateSDK.cpUpdateCheck(this, new MyCPCheckUpdateCallback());
权限
依赖
compile files('libs/BDAutoUpdateSDK_20150605_V1.2.0.jar')
混淆
-dontwarn com.baidu.**
-keep class com.baidu.** { *;}
清单文件
android:name="com.baidu.autoupdatesdk.ConfirmDialoigActivity"
android:exported="false"
android:theme="@style/bdp_update_dialog_style_fullscreen"/>
android:name="com.baidu.autoupdatesdk.receiver.BDBroadcastReceiver"
android:exported="false">
android:name="BDAPPID"
android:value="你申请的id"/>
android:name="BDAPPKEY"
android:value="你申请的key"/>
360自动更新
360更新代码
//初始化弹窗
UpdateHelper.getInstance().init(getApplicationContext(), Color.parseColor("#0A93DB"));
//手动点击升级(建议)
UpdateHelper.getInstance().manualUpdate("你的包名");
/*
参数packageName:应用的包名
参数forceUpdate:是否强制更新。当forceUpdate = true时进行强制更新,更新窗口无法被销毁;当forceUpdate = false时不强制更新,更新窗口可以被销毁
参数queryIntervalMillis:弹窗间隔毫秒时间。当第一次出现更新弹窗后,在queryIntervalMillis毫秒内进行第二次函数调用不会查询更新
UpdateHelper.getInstance().autoUpdate(String packageName, final boolean forceUpdate, final long queryIntervalMillis);
*/
//自动升级
UpdateHelper.getInstance().autoUpdate("你的包名", false, 10000);
权限
依赖
compile files('libs/360update-7.0.3.jar')
清单文件
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
android:exported="false"/>
//authorities必须修改为您的包名
android:authorities="你的包名"
android:exported="false"
android:grantUriPermissions="true">
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/update_apk_path"/>
XML
在资源res目录下添加xml目录,并放入update_apk_path.xml文件: