October 2018
Intermediate to advanced
464 pages
15h 17m
English
We'll just be using Toast messages to respond to the hardware events and therefore will not need to make any changes to the activity layout. The first step is to add the V13 support library to the project. Start by opening build.gradle (Module: app) and perform the following steps:
implementation 'com.android.support:support-v13:28.0.0-rc02'
MediaSessionCompat.Callback mMediaSessionCallback = new MediaSessionCompat.Callback() { @Override public void onPlay() { super.onPlay(); Toast.makeText(MainActivity.this, "onPlay()", Toast.LENGTH_SHORT).show(); } @Override public void ...