Sony SmartWatch 2: need to change support LowPowerMode () at runtime

I have an application for SW2 that has a user option for use in low power mode (LPM). Which works well. The problem is that the SW API only calls my application, supporting the registration method LowPowerMode () once when it starts first. This means that if the user later changes the setting in my application, he will not take effect until the entire shebang has started.

I tried a few tricks (for example, kill the process of my application) to force a reboot, but so far nothing worked. My last resort is telling the user that he / she needs to restart the phone before it takes effect, but it’s pretty hokey. Is there a better way?

+4
source share
2 answers

The solution is not to try to change your response at supportsLowPowerMode()runtime, but to start and stop your extension.

, LPM, true supportsLowPowerMode(). LPM , , onActiveLowPowerModeChange(). , LPM, , :

@Override
public void onActiveLowPowerModeChange(boolean lowPowerModeOn) {
    super.onActiveLowPowerModeChange(lowPowerModeOn);

    if (lowPowerModeOn) {
        // User doesn't want to use LPM, so stop the app on the SW
        stopRequest();
    }
}

, , LPM.

EDIT: , . false supportsLowPowerMode(), SW2 ( ) , . , , "" SW2, . stopRequest() ( ) , SW2. ; pauseRequest(), API .

+1

, . , , .

+1
source

Source: https://habr.com/ru/post/1534180/


All Articles