In Play Console I see users get an IllegalStateException in the sendMessage chromecast call. According to the API:
IllegalStateException: If this method is not called on the main thread.
However in my code I call it in the following way:
Handler uiHandler = new Handler(Looper.getMainLooper());
uiHandler.post(new Runnable(){
@Override
public void run() {
mCastSession.sendMessage(mMyChannel.getNamespace(), message);
}
});
What could be the problem here? I cannot reproduce it myself.