Get NuPlayer setup on Android 5.0

In the new Android 5.0 Lollipop, a new option has been added to Developer Options called "Use NuPlayer (beta)". My application sometimes does not work when this option is enabled. I am afraid that when the new version of Android is released to the public, many people would turn it on and have problems with my application, not knowing what was wrong.

So, I wanted to display a warning message about this only if the NuPlayer parameter was set on the device. I tried to find it in the Android documentation, but I could not find how to access the status of this new setting.

So the question is, how can I check the value of this parameter programmatically?

thank

+4
source share
1 answer

I pass my answer from here on request:

Prevent my audio app using NuPlayer on Android Lollipop 5.x?

So, I finally found a way to safely detect whether or not it NuPlayerwill be used or not on Lollipop. It seems like the best strategy is to tell the user to open the developerโ€™s settings and turn it on AwesomePlayeruntil Google installs NuPlayer. Unfortunately, there is no good way to change this parameter for the user, we can just read its value if you are not subscribed as a system application.

Android, , AwesomePlayer . Lollipop NuPlayer , , , NuPlayer .

SystemProperties.java , android.os (it JNI-, ).

, Lollipop/5.0, AwesomePlayer , (, ):

public void openDeveloperSettingsIfAwesomePlayerNotActivated(final Context context) {
    final boolean useAwesome = SystemProperties.getBoolean("persist.sys.media.use-awesome", false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !useAwesome) {
        final Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
        context.startActivity(intent);                
    }
}
+5

All Articles