Aarogyasetu_android: Support for Android 10 and above

Created on 26 May 2020  路  5Comments  路  Source: nic-delhi/AarogyaSetu_Android

To support and run this app seamlessly on Android 10 or above there should be permission ACCESS_BACKGROUND_LOCATION. Because this permission is needed to be granted to access location in the background. Otherwise this application will not work on devices having Android 10 or above OS version. If it looks good to you then I'll be happy to work on it.

Most helpful comment

@PatilShreyas, When this app is in background, It uses "Foreground Service". Hence ACCESS_BACKGROUND_LOCATION is not required since app with a active foreground service is not considered as background. (applicable for Android 8.0 (API level 26) and above).

Refer https://developer.android.com/about/versions/oreo/background for more details,

An app is considered to be in the foreground if any of the following is true:

  • It has a visible activity, whether the activity is started or paused.
  • It has a foreground service.
  • Another foreground app is connected to the app, either by binding to one of its services or by making use of one of its content providers.

Hence, this issue is invalid and should be closed.

All 5 comments

@PatilShreyas, When this app is in background, It uses "Foreground Service". Hence ACCESS_BACKGROUND_LOCATION is not required since app with a active foreground service is not considered as background. (applicable for Android 8.0 (API level 26) and above).

Refer https://developer.android.com/about/versions/oreo/background for more details,

An app is considered to be in the foreground if any of the following is true:

  • It has a visible activity, whether the activity is started or paused.
  • It has a foreground service.
  • Another foreground app is connected to the app, either by binding to one of its services or by making use of one of its content providers.

Hence, this issue is invalid and should be closed.

Hi @divyeshsachan see this:https://developer.android.com/about/versions/10/privacy/changes.

@PatilShreyas from the link you shared,

An app is considered to be accessing location in the background unless one of the following conditions is satisfied:

*An activity belonging to the app is visible.

*The app is running a foreground service that has declared a聽foreground service type聽of聽location.

As @divyeshsachan mentioned the app is running a foreground service.

@PatilShreyas , I have already provided you the reason why ACCESS_BACKGROUND_LOCATION is not required by this app.
Android has very good documentation. You should always read the documents carefully. In your link https://developer.android.com/about/versions/10/privacy/changes refer heading "Access to device location in the background requires permission". It is clearly written there,

An app is considered to be accessing location in the background unless one of the following conditions is satisfied:

  • An activity belonging to the app is visible.

  • The app is running a foreground service that has declared a foreground service type of location.

  • To declare the foreground service type for a service in your app, set your app's targetSdkVersion or compileSdkVersion to 29 or higher. Learn more about how foreground services can continue user-initiated actions that require access to location.

This app uses "foreground service" when activity is destroyed/or in background, Hence, this app will never be considered as background by android OS so ACCESS_BACKGROUND_LOCATION is not required at all.

Footnote: I am the developer of various apps and i know all the pitfalls of accessing location in android 8 and above. Adding to it, few manufacturers (specially MI, OnePlus, RealMe) have added additional background restrictions (mostly undocumented) upon life-cycle of android apps to save user battery. Mark my words: The only robust solution to access device location periodically is by using foreground service and it works on all android phones irrespective of their OS version, phone model or anything.

Okay @divyeshsachan thanks for the clarification.

Was this page helpful?
0 / 5 - 0 ratings