Important changes on Android8.0 (Android O) that deserve your attention

Source: Internet
Author: User

Just finished with Android7.0 not long before, see Google's official launch of the Android8.0 (Android O) Developer preview of the news, my mood you can think about. For the upper-level app developer, I'm fine with the new version, and it's painful for people with JNI and a lot of deep revisions. So this time the big version is updated, and when will the final stereotypes be released? What new constraints and changes have she brought to the impact of our existing applications? What are the new features that can be used to add novel and interesting features?

This article is to organize the official preview document at the same time, run some sample code, for you to show. If you have good English and plenty of time, there are official documentation links at the end for you to explore and experience yourself.

Android o perfect plan and release time

Google pushed android o developer preview for the first time on March 21, 2017, and then the next update and real stability to Android O, when was the final release? Timeline chart for borrowing official documents:

From the above can be seen, the release of the DP1 (Developer Preview Version) of the updated version DP2 between Five and June, and DP1 and DP2 are mainly for developers, find compatibility issues, experience the new features of feedback, at this time the system image itself has a lot of stability issues, not suitable for daily use;

DP3, DP4 has been providing the final API and the official SDK by July, on the basis of which you can do complete compatibility testing and develop new features based on new features. The final release of Android O is scheduled for the third quarter.

According to previous experience, the OTA upgrade of the old equipment began in the third quarter until the end of the year, while the new aircraft release and the upgrading of the older equipment in the country continued into the second March or April. Therefore, from the last release time, it is now possible to breathe a sigh of relief. But many of the actual situation is very early completion of the Google pro-son mobile phone adaptation work, and domestic mobile phone manufacturers to revise, bringing many other uncertainties. So the early preparation, the heart knows, after all, the early bird has worms to eat.

new limitations and changes

The limitations and changes of the new version of Android are mainly divided into two aspects, one affecting all apps, and the other affecting new versions of the app (mainly targetsdkversion pointing to the newer version). The latter is well suited, the general application will not be very quick to modify the targetsdkversion, while the former is real need to start immediately follow up.

Affects all applications:

1. Background restrictions

(1) Background operation limit

    • When an app enters the background, there are no visible and running components (such as a background service), and the system releases the wake-up lock held by the app (Wakelock)

    • Using the Notificationmanager.startserviceinforeground () method to enable the foreground Service, the old method is no longer valid

(2) Background location access restrictions
In the Android O system, the application running in the background can no longer receive the information of the location update frequently, but the specific update frequency reduces to how much, also needs the most republication post-release test to determine

2. Security-related changes

(1) Platform no longer supports SSLV3
(2) Httpsurlconnection when HTTPS link is established, no longer automatically switch to the earlier TLS protocol version retry
(3) The WebView instance of the application will run in a separate process

3. Changes in privacy Policy

(1) android_id is no longer shared by all apps in the device, but is different for each app, and is differentiated by the package name and signature, and the reinstallation will not change after uninstalling, but it should not be consistent with the last time when the phone is factory reset

(2) Gets the system attribute Net.hostname, will get null

4. Apply Shortcut Changes
Creating a shortcut in Com.android.launcher.action.INSTALL_SHORTCUT mode is no longer valid, but using the Shortcutmanager requestpinshortcut () method.

5.Alert window display changes
After declaring the System_alert_window permissions, choose to use Type_system_alert to display the popup on top of other apps, and the Android O system will appear under the Type_application_overlay type window. The targetsdkversion for Android O uses Type_application_overlay to display the alter Window directly. This way your frame may still be under the window of someone else's pop-up.

6. Other
(1) Bluetooth: Scanrecord.getbytes () method change
(2) Keyboard navigation: Enable the app to support physical keyboard navigation (previously, just a re-mention)
(3) network connection and HTTPS Related: After connect failed, call Send (Datagrampacket) will throw socketexception, and some other details of the change
(4) When the set is empty, Abstractcollection.removeall () and Abstractcollection.retainall () will throw NullPointerException
(5) Localization and internationalization: such as Currency.getdisplayname () method default Call Locale.getdefault (Category.display), default time zone resolution, etc.
(6) Contact statistics: no longer provide contact email or phone number of accurate contact information, but only provide approximate value

Impact for Android O Apps:

1. Background Restrictions
(1) StartService () will throw illegalstateexception
(2) Restrict registration of receiving implicit broadcasts in androidmanifest.xml, such as action_package_replaced, but there are some exceptions such as Action_boot_completed,action_locale_ CHANGED (all exceptions refer to the end of the text connection). (Note that this limitation is only for Android O for Targetsdkversion, or the SDK for Android O and above, and below is unaffected)

2. Privacy-related changes
(1) Get System Properties net.dns1, Net.dns2, NET.DNS3, and NET.DNS4 are no longer available
(2) no longer supports build.serial, but instead build.getserial ()

3. Local library changes
Mandatory on Android O segment cannot have both write and execute, such as data segment is not executable, code snippet is not writable.

4.ContentProvider Notification of changes
Call Contentresolver.notifychange () and Registercontentobserver (Uri, Boolean, contentobserver) to implement notifications and listen for changes on certain URIs on Android O on the request URI corresponding to the ContentProvider to be correctly defined, but there is no definition of what the problem does not mention

5. Other
Alter window display, collection sorting method change and get user account permissions change, etc.

new Features

At the time of writing, Google has officially introduced some Chinese documents (which should be updated soon), and in view of this, we will only show interesting and sample code for multi-channel (channel) notifications, Pip and AutoFill frames

1. Multi-channel Notifications
My understanding is that the notification of the application is refined, divided into different categories, like a TV channel, you can operate on the channel. If the user can block notifications for a channel, not all notification messages for the app, developers can set notifications for the channel to vibrate, sound, and so on.

The notification shows and turns out to be no big difference, as shown in:

You can see controls for a channel notification in Settings

2. Pip Picture
Activity is displayed in one way, as long as you set Android:supportspictureinpicture to true in Androidmanifest.xml, as shown:

Note that the activity in PIP mode will callback the OnPause method, so the application like playing the video class does not stop playing in the OnPause, but stops in the OnStop method.

3. Auto-fill frame (autofillframework)
It is simply divided into applications that provide autofill services and applications that use AutoFill. The former provides the ability to automatically populate and save data by inheriting the view structure on the Autofillservice parsing interface, which can be used without modification on standard view, and custom view has to do some processing. But the application that provides AutoFill service needs to obtain the trust, also must do many additional things, the follow-up promotion does not know whether can push aside.

Originally modified the test demo can be used in the notification Bar demo auto-fill function, the results of the system is not stable, has been unable to display the auto-filled pop-up window on any page, but also a few crashes, so no.

How to experience Android O

The procedure for brushing your device to Android O is simple, first look for the device on your hand that supports Android O preview version
Nexus 5X
Nexus 6P
Nexus Player
Pixel C
Pixel
Pixel XL

I am using the Nexus 6P, the steps are as follows: Website link

1. Download to the corresponding ZIP package
Extract, the directory contains the flash-all.sh

2.USB connecting the phone
Ensure that you can invoke the ADB command, which is to set the path of the ADB command in the environment variable

3. Enter FastBoot mode
ADB reboot bootloader
(No key entry is used)

4. Unlocking the bootloader
Try using fastboot flashing unlock or fastboot OEM unlock, my phone has been unlocked and therefore not used

5. Swipe into the new system
At the terminal command line, cut to the directory after the zip file was extracted, that is, in the flash-all.sh directory; Execute flash-all.sh (Windows can use Flash-all.bat). After execution, you can enter Android O

6. Lock Bootloader
Perform fastboot flashing lock or fastboot OEM lock, I did not perform

Finally, please refer to the official documents that were last issued. And this version is only for developers to experience and test feedback, not suitable for daily use, to avoid unnecessary trouble.

Reprint Please specify source: http://blog.csdn.net/w7849516230, Welcome to the public number "Programming Sunshine"

1.Android O Preview Official notes
2. An implicit broadcast that can be registered

Important changes on Android8.0 (Android O) that deserve your attention

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.