Open Diapolo opened 2 years ago
See https://github.com/microg/GmsCore/issues/1356 where we tried to get to the bottom of this.
Tl;DR: it doesn't work without enabled location services.
Also refer to https://codeberg.org/corona-contact-tracing-germany/cwa-android#why-does-the-app-need-location-permission which explains why this works for google ENF but not for us.
This code isn't complete and need testing but it theoretically should be able to detect when EN may work with location setting disabled in the device. I have just written it in notepad.
boolean need_device_location_enabled = true;
boolean strict_location_check = true;
string exposure_notification_package = "";
if (Build.VERSION.SDK_INT < 23) {
strict_location_check = false;
} else {
try
{
PackageManager manager = getPackageManager();
Resources resources = manager.getResourcesForApplication("com.android.bluetooth");
try
{
int resId = resources.getIdentifier("strict_location_check", "boolean", "com.android.bluetooth");
strict_location_check = resources.getBoolean(resId);
}
catch (Exception e)
{
}
if (Build.VERSION.SDK_INT >= 30) {
try
{
int resId = resources.getIdentifier("exposure_notification_package", "string", "com.android.bluetooth");
exposure_notification_package = resources.getString(resId);
}
catch (Exception e)
{
}
}
}
catch (Exception e)
{
}
}
if (strict_location_check != true) {
need_device_location_enabled = false;
} else if (microg_en_is_used == true && exposure_notification_package == "com.google.android.gms") {
need_device_location_enabled = false;
} else if (internal_package_en_is_used == true && exposure_notification_package == package_internal_name) {
need_device_location_enabled = false;
}
PS: Moved from here => https://github.com/microg/GmsCore/issues/1796#issuecomment-1269534917
As far as I know, under Android 11 it should not be necessary to have location services active for exposure notifications to work. But when I disable them I get a microG warning, telling me they need to be active. Could this be fixed with a new release :)?
Thanks, Dia