New Android R Important Changes

Review of the new Android R features and changes

Elvina Sh
ProAndroidDev
Published in
3 min readJun 4, 2020

--

Photo by MUTIfrom Dribbble

Hi there! I am from the Navigine team. For eight years we have been providing integrated positioning mobile technologies that enable advanced indoor navigation and proximity solutions. This article will be devoted to changes in the new android, which will appear from day to day, but previews and docks for which are already available.

First of all, we want to note that here we will not analyze all the innovations and changes, but we will turn to the most important ones, in our opinion, so if you don’t find something, write in the comments. Well, now let’s get started!

Camera and Microphone on the foreground more protected for user

Since Android 9 you were available to use a camera and microphone only in the foreground. Now starting from Android 11, you need to write service type into your manifest file like in the code snippet below. By the way, this restriction will work only for Android 11 now, so Google will give extra time for developers for adapting to this change.

AsyncTask deprecated

Starting from this version of the Android async task will be deprecated. Async task is used to do short running operations on the background thread, and publish results on UI Thread. Android advice to use thejava.util.concurrentor Kotlin Coroutines. Here is the example code below.

Wi-Fi suggestion API

Devices running Android 10 and higher allow your app to add network credentials for a device to auto-connect to a Wi-Fi access point. You can supply suggestions for which network to connect to using WifiNetworkSuggestion. The platform ultimately chooses which access point to accept based on the input from your app and others.

By the way, you should know that if the user uses the Wi-Fi picker to explicitly disconnect from one of the network suggestions when connected to it, then that network is blacklisted for 24 hours. During this time, that network will not be considered for auto-connection, even if the app re-adds the network suggestion corresponding to the network.

Concurrent use of more than one camera

Android 11 adds APIs to query support for using more than one camera at a time, including both a front-facing and a rear-facing camera.

  • There is a method for getting the set of combinations of currently connected camera device identifiers, which support configuring camera device sessions concurrently.
  • And another method for performing a runtime check of the given SessionConfigurationand camera id combinations.

Reading phone numbers permission changed

If your app targets Android 11 and needs to access the phone number API methods getLine1Number()and getMsisdn(), you must request the READ_PHONE_NUMBERSpermission, instead of the READ_PHONE_STATEpermission. Here is the manifest example of getting permission for all Android versions.

New WiFi scan as a replacement for Deprecated one

Probably one of the main innovations for us is the replacement of the old WiFi scan, which was deprecated in API 28. At the moment, the documentation for scanning the wifi is not updated and new restrictions are not written. But these limitations will definitely exist, and there is still no complete information on how the new scan will work. However, you can already see what they are and how to use them.

Now you need to register the scan results callback instead of start scan, pass there new ScanResultsCallback class element. You should override its onScanResultsAvailable() method and there you can call get scan results method (provided in the code snippet). And also there is a method for unregistering scan callback.

Conclusion

The release of the new version of Android is scheduled for the near future, although it is already possible to test all the possible functionality, and most of the new functionality is documented. It is also worth noting that it is already possible to test new functionality if you have a new version of Android Studio with a version higher than 4.

Of course, we described a very small part of the new changes and new functionality, there are a lot of new features and possible limitations that we have not yet noticed. Howbeit, we will have to take these changes into account and adapt to them. Feel free to write your opinions and recommendations.

Author is Navigine’s Android Developer — Il Kadyrov

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Written by Elvina Sh

Marketing associate at Navigine.com — Integrated software platform for precise indoor and outdoor positioning.

Responses (1)

Write a response