Op di 2 apr. 2019 om 10:52 schreef Majka <[email protected]>:

>
> Some devices need more - battery saving for an app needs to be switched
> off and the app has to be locked in the memory. Most devices work with just
> disabling the battery saving and Osmand fine. Some needs additionaly to
> lock the app in the memory (MIUI, for example). If your system has
> something similar, you have to do it as well. Check the permissions as well
> - how these work is not that straightforward. The permissions are grouped
> such a way that you sometimes need to give permission which by the name
> seems to be quite a different from the reason why you need it.
>
> I don't have this problem with latest OsmAnd (nightly), it seems to be
> specific to your system. Just to be clear, I am not saying it is not a true
> problem for you.
>
> Majka
>


The only android permission that would do this is  <uses-permission android:
name="android.permission.WAKE_LOCK" />
in combination with
<uses-permission
android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

Both have been enabled in the AndroidManifest.xml
<https://github.com/osmandapp/Osmand/blob/master/OsmAnd/AndroidManifest.xml#L16>
of Android
On higher versions of Android (7.0 and up) some permissions need to be
requested also in the activities. I do not know whether

PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
        "MyApp::MyWakelockTag");
wakeLock.acquire();

This permission seems to be disabled on my phone for OsmAnd.

Note that I do not want the

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

I want the screen to switch off.

-- 
You received this message because you are subscribed to the Google Groups 
"Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to