Android-Android6.0新特性-略讲1

来源:互联网 发布:手机vpn软件 编辑:程序博客网 时间:2024/06/13 17:32

下面介绍下Android6.0的新特性(略讲 以后会分章节讲)


1.Runtime Permissions(运行时检查和请求权限)

调用checkSelfPermission()检查是否有权限 requestPermissions()请求权限


2.Doze and App Standby(睡眠和APP的备份) 

这两个功能是为了节电用的 手机耗电快一直是诟病

Doze:官方说:If a user leaves a device unplugged and stationary for a period of time, with the screen off, the device enters Doze mode. 就是手机屏幕暗下来的 手机就进入了Doze模式


进入这个模式后Android系统会干些什么呢:

首先限制网络的连接 限制密集型的CPU操作

然后过一段时间又连接网络和做一些之前延迟的CPU操作 然后又进入Doze模式 如此循环来达到省电

官方文档的图:


就是睡一会有唤醒干一下活然后又睡了


然后会对我们的应用造成什么样的影响呢


1.我就不知道QQ即时通信应用可能会没有及时弹出qq信息

2.AlarmManager会影响到

具体看官网文档


App Standby:这个更好理解 就是如果有一个应用我很久没使用了 我就限制它的联网或者做其他操作(毕竟联网很耗电的) Android官方说可以让他们一天一次联网的说


3.Apache HTTP Client Removalns

卧槽 把Apache的httpClient去掉了 叫你用他开发的HttpURLConnection

官方的理由是:因为httpURLconnection有压缩有缓存 挺好的


如果你非要使用就用这个吧

android {    useLibrary 'org.apache.http.legacy'}


.4.BoringSSL

其实这个是什么鬼 没用过 摘取官方文档 有人知道的告诉我一声

Android is moving away from OpenSSL to the BoringSSL library. If you’re using the Android NDK in your app, don't link against cryptographic libraries that are not a part of the NDK API, such as libcrypto.soand libssl.so. These libraries are not public APIs, and may change or break without notice across releases and devices. In addition, you may expose yourself to security vulnerabilities. Instead, modify your native code to call the Java cryptography APIs via JNI or to statically link against a cryptography library of your choice.


其实这个是什么鬼 没用过 摘取官方文档 有人知道的告诉我一声


5.Access to Hardware Identifier(访问硬件标识符)

首先加入权限 ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION

可以访问比如WIFI蓝牙这些硬件的标识符 好吧暂时似乎对我没什么用


6.Notifications

去掉了方法Notification.setLatestEventInfo()

建议我们用 Notification.Builder 构建notification


还有下回分解

0 0