Android 12

Android 12

Intro

Android 12 introduced new features and behaviors, from permissions to security, that affect directly the NAO® SDK. All the changes are described on Android 12’s documentation.

NAO® SDK Release 21.02 (v4.10.x) will still work as expected with applications targeting Android 11.

However, it is not compatible with applications targeting Android 12. You will need to integrate the Release 21.09 (NAO® SDK version 4.11.3).

What’s New ?

Location permission

“Approximate location” permission model.

On Android 12, users can navigate to system settings to set the preferred location accuracy for any app, regardless of that app’s target SDK version. This is true even when your app is installed on a device running Android 11 or lower, and then upgrades to Android 12. If the user downgrades your app’s location access from precise to approximate, either from the permission dialog or in system settings, the system restarts your app’s process. NAO® SDK requires ACCESS_FINE_LOCATION permission to work.

Please refer to the Android documentation: https://developer.android.com/about/versions/12/approximate-location.

Upgrade to precise location

To request that the user upgrade your app’s location access from approximate to precise, do the following:

  1. If necessary, explain why your app needs the permission.
  2. Request the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions together again. Because the user has already allowed the system to grant approximate location to your app, the system dialog is different this time.

Background location

Background location permission ACCESS_BACKGROUND_LOCATION has to be requested separately.

Bluetooth

There are new bluetooth permissions. Please refer to the Android 12 documentation: https://developer.android.com/about/versions/12/features/bluetooth-permissions.

If your app targets Android 12 it must declare the new introduced BLUETOOTH_SCAN permission, which lets your app scan for nearby devices without needing to request the location permission. This is a runtime permission, therefore, you must explicitly request user approval in your app.

Foreground

Apps that target Android 12 can no longer start foreground services while running in the background, except for a few special cases. If an app attempts to start a foreground service while running in the background, an exception occurs (except for the few special cases). Consider using WorkManager to schedule and start work while your app runs in the background.

Background

Application that target Android 12 and use exact alarms should only be used for user-facing features, such as one of the situations described in the acceptable use cases section. Otherwise application should obtain a special app access by requesting the SCHEDULE_EXACT_ALARM permission in the manifest.

How does it affect my app ?

There are several situations to consider. Here under a table to summarize how the NAO® SDK would behave according to app life-cycle events and OS configurations.

If you need a reminder on how to integrate the NAO® SDK with previous versions of Android, feel free to read https://docs.nao-cloud.com/docs/misc/android-update/.

    • Related Articles

    • Android

      NAOMAPSDK is a mobile map tool that allows developers to integrate indoor maps into Android and iOS applications using map data from NAO Cloud. This SDK simplifies the process of adding indoor mapping functionality to mobile apps, making it easier ...
    • Release 21.09 (NAO SDK 4.11)

      Versions Component Version Hotfix Hotfix 21.09.01 NAO® Cloud 21.09.0 21.09.01 NAO® SDK iOS 4.11.3 4.11.4 4.11.5 NAO® SDK Android 4.11.3 4.11.4 4.11.5 NAO® Logger iOS 4.11.3 4.11.4 4.11.5 NAO® Logger Android 4.11.3 4.11.4 4.11.5 New Features NAO® SDK ...
    • Android 8

      Android 8.0 (API level 26) introduces behavior changes as well as new features and APIs. The key changes that impact NAO SDK are Android background execution limits. If you are using NAO SDK only in a user-app interactive way, there will not be much ...
    • Release 21.02 (NAO SDK 4.10)

      Versions Component Version NAO® Cloud 21.02.0 NAO® SDK iOS 4.10 NAO® SDK Android 4.10 NAO® Logger iOS 4.10 NAO® Logger Android 4.10 Important Note : AndroidX & NAO® SDK Since 2018, Google maintains the AndroidX library to provide backward ...
    • Release 20.06 (NAO SDK 4.9)

      Release 20.06 NAO Cloud – July, 9th 2020 New Features Import Visioglobe places as geofences. Beacons guidelines conformity: a new heatmap is now available, highlighting the areas that do not meet the radio requirements for the location engine. It is ...