iammert / RadioPlayerService

Android service library which uses AAC Player. Ready to use Radio Player Service.
254 stars 91 forks source link

when radio playing then press back exit app and open app again radio not playing #28

Closed mahmooddagga closed 7 years ago

mahmooddagga commented 7 years ago

i was put context MainActivity.this i am trying change context and the result various ,,.... i try getApplicationContext but listner not fire

i think getBaseContext its best result mRadioManager = RadioManager.with(getBaseContext());

mahmooddagga commented 7 years ago

@iammert @muratcanbur

mahmooddagga commented 7 years ago

i solve it i solve the problem by checking if its playing then stop -- before was always on press back stop may it causes issues

@Override
public void onBackPressed() {
            **if (mRadioManager.isPlaying())**
                mRadioManager.stopRadio();
            mRadioManager.disconnect();
            mRadioManager = null;
        super.onBackPressed();
    }