public void start() { startNotification(); player.start(); state = State.Playing; sendState(); }
public void pause() { if (player.isPlaying()) { stopForeground(true); state = State.Pause; player.pause(); sendState(); } }
@Override public void onCreate() { super.onCreate(); Log.d("myLog", "" + this); if (player == null) { player = MediaPlayer.create(this, R.raw.song); player.setOnCompletionListener( new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { stopForeground(true); state = State.Idle; sendState(); } }); sendState(); } }