application标签及自定义Application
manifest.xml中
application标签
<application
android:name="com.xxx.application.MyApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:allowClearUserData="true"
>
<meta-data
<service
<receiver
<activity
android:name 可以和java文件关联 通过java文件设置整个application
MyApplication extends Application
android 程序启动 会启动一个 application类的单例对象
可以自定义 类 去继承 application
进行一些初始化的配置 和设置
主要是重写onCreate方法
// logger的开启
// init logger
Logger.addLogAdapter(new AndroidLogAdapter());
Logger.addLogAdapter(new DiskLogAdapter());
// init AndroidNetworking
AndroidNetworking.initialize(getApplicationContext());
// init bugly report
//...
android:allowBackup 默认为true
当allowBackup标志为true时,用户即可通过adb backup和adb restore来进行对应用数据的备份和恢复,这可能会带来一定的安全风险
Android属性allowBackup安全风险源于adb backup容许任何一个能够打开USB 调试开关的人从Android手机中复制应用数据到外设
普通图标
android:icon=”@mipmap/ic_launcher”
圆形图标
android:roundIcon=”@mipmap/ic_launcher_round”
允许right-to-left布局 默认为false
android:supportsRtl=”true”
主题
android:theme=”@style/AppTheme”
桌面图标的名称
android:label=”@string/app_name”
是否允许应用管理者清楚数据的权限 默认为true
android:allowClearUserData=”true”