diff --git a/docs/html/training/auto/audio/index.jd b/docs/html/training/auto/audio/index.jd index 9144900a9d995..aa20e3a29f9b2 100644 --- a/docs/html/training/auto/audio/index.jd +++ b/docs/html/training/auto/audio/index.jd @@ -20,6 +20,7 @@ page.image=auto/images/assets/icons/media_app_playback.png
+To prevent user distraction, Android Auto media apps must not start playing audio + through the car speakers unless a user consciously starts playback (such as + when the user presses play in your app). Even a user-scheduled alarm from the + media app must not start playing music through the car speakers. + If your media app has an alarm feature, the app should determine if the phone + is in +car mode +before playing any audio. Your app can do this by calling +UiModeManager.getCurrentModeType(), + which checks whether the device is running in car mode. +
+ ++If the device is in car mode, media apps that support alarms must do one of the +following things: + +
+ public static boolean isCarUiMode(Context c) {
+ UiModeManager uiModeManager = (UiModeManager) c.getSystemService(Context.UI_MODE_SERVICE);
+ if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
+ LogHelper.d(TAG, "Running in Car mode");
+ return true;
+ } else {
+ LogHelper.d(TAG, "Running on a non-Car mode");
+ return false;
+ }
+ }
+