Google keeps rejecting my app for the following reason: "During review, we found that if audio is playing on the device while plugging into the Android Auto experience, the music continues to play through the car speakers without user intent. We see this as a driver distraction, and isn't appropriate for Android Auto apps."
I thought I had taken the appropriate steps to resolve this by following the documentation from here: https://developer.android.com/training/auto/audio/index.html#isconnected
However, they rejected me again for the same reason.
In my MediaBrowserServiceCompat StreamService class, I've added the following code:
private IntentFilter androidAutoConnectionIntentFilter = new IntentFilter("com.google.android.gms.car.media.STATUS");
private AndroidAutoConnectionStatusReceiver androidAutoConnectionStatusReceiver = new AndroidAutoConnectionStatusReceiver();
In the onCreate(), I've added:
registerReceiver(androidAutoConnectionStatusReceiver, androidAutoConnectionIntentFilter);
and added this class to the service as well:
private class AndroidAutoConnectionStatusReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("*** ANDROID AUTO CONNECTED: " + intent);
String status = intent.getStringExtra("media_connection_status");
boolean isConnectedToCar = "media_connected".equals(status);
if (isConnectedToCar) {
// android auto connected so stop playback
Intent stopIntent = new Intent(context, StreamService.class);
stopIntent.setAction(StreamService.ACTION_PLAYER_STOP);
context.startService(stopIntent);
}
}
}
Any idea how I can update my app to resolve this rejection?
new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
– MatherlyAUDIOFOCUS_LOSS
developer.android.com/training/managing-audio/… – Matherly