문제

[SOLVED] I did not have the same namespace on both ends.

I have this manual page about the Google cast companion library and I don't understand the part about 'Support for data-centric applications' where it says

"This will send a message. Messages that are sent to the sender from the receiver can be captured by extending DataCastConsumerImpl class and overriding the following callbacks:"

I have all the code for sending the message but when I press the 'confirmButton' nothing happens and the log doesn't throw any exceptions. So I wanted to add the 'onMessageSendFailed' callback but I have no idea how to add it to my code.

Thank you in advance for your help! If you need more info I will be glad to give it!

도움이 되었습니까?

해결책

First, what do you expect to happen when you send that message? Is your receiver registered to receive messages on that namespace? Is that not happening? You need to be more clear when you say "nothing happens". As for capturing onMessageSendFailed() callback, you need to either implement IDataCastConsumer or extend DataCastConsumerImpl and override the method(s) that you are interested in and then register your implementation with the DataCastManager instance:

mDataCastConsumerImpl = new DataCastConsumerImpl(){
   public void onMessageSendFailed(Status status) {
       // do as you want
   }
   ....
}

...
mDataCastManager.addDataCastConsumer(mDataCastConsumerImpl);
...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top