Reputation: 9038
I'm using the Cast Companion Library and want to receive messages from my custom receiver via a custom namespace.
I'm able to use other callback methods without issue, but when I try to add onMessageReceived() to my code, Eclipse will give this error:
The method onMessageReceived(CastDevice, String, String) of type new VideoCastConsumerImpl(){} must override or implement a supertype method
Here's the code:
private void setupCastListener() {
mCastConsumer = new VideoCastConsumerImpl() {
// THIS WORKS:
@Override
public void onApplicationConnected(ApplicationMetadata appMetadata,
String sessionId, boolean wasLaunched) {
Log.i(LOG_TAG, "CAST APPLICATION CONNECTED");
}
// WONT LET ME ADD THIS:
@Override
public void onMessageReceived(CastDevice castDevice, String namespace, String message) {
}
};
}
Upvotes: 0
Views: 278
Reputation: 9038
Maybe I misread the documentation, but digging in the VideoCastManager code showed the correct callback method to override is:
@Override
public void onDataMessageReceived(String message) {
Log.i(LOG_TAG, "CAST RECEIVED MESSAGE");
}
Upvotes: 1