1

I'm using AmbientModeSupport for an Androi Wear OS application: https://developer.android.com/training/wearables/overlays/always-on

Just finished implementing/testing it and everything worked as expected. After app release I noticed that the feature is not working properly when the app is downloaded from Google Play.

I did some extra testing and:

  • Everything works if app is installed in debug-mode.
  • The Ambient feature is not working well if app is installed in release-mode.

In release-mode, the screen just lowers it's brightness, but there are no changes on the UI (changes performed in onEnterAmbient). The WAKE_LOCK permission is already provided in AndroidManifest:

<uses-permission android:name="android.permission.WAKE_LOCK" />

Any ideas?


UPDATE: After I thought I'm completely out of ideas, I realized that my build.gradle has 2 extra things for the release-mode, the proguard and the minify flags:

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

It seems that the minifyEnabled caused the problem. I don't know why this behavior occured, but the Ambient Mode is working if I remove the minifyEnabled flag.

0 Answers0