Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CastStateListner not getting called in fragment #92

Open
wahdatjan opened this issue Aug 5, 2020 · 0 comments
Open

CastStateListner not getting called in fragment #92

wahdatjan opened this issue Aug 5, 2020 · 0 comments

Comments

@wahdatjan
Copy link

wahdatjan commented Aug 5, 2020

CaststateListener not getting called in Fragment.
i am calling it in onresume . when fragment starts nothing happen during onresume .But when app goes in background so onstop is being called then coming back to foreground onresume is being called , at that time listner works .
` @OverRide
public void onResume() {
super.onResume();
castContext.addCastStateListener(new CastStateListener() {
@OverRide
public void onCastStateChanged(int i) {
if (i == CastState.NO_DEVICES_AVAILABLE){
mediaRouteButton.setVisibility(View.GONE);
}
else {
mediaRouteButton.setVisibility(View.VISIBLE);
}

            if (CastState.CONNECTED == i){
                EventTrackingManager.getEventTrackingManager(mContext).trackClickedItem(TrackingEvents.CHROMECAST_CONNECTED,null);
            }
        }
    });

}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant