I'm using a simple receiver based on the Google CastHelloText sample app. When the sender disconnects, I'd like to allow the receiver to continue display.
I thought this could be accomplished by modifying the receiver's onSenderDisconnect function to skip the window.close call but when I disconnect my sender by calling session.stop, the receiver is shutdown withou a call to onSenderDisconnect. I see a "Dispatching shutdown event" in the receiver log.
How can I get the receiver to continue without the sender connection?
If you want to allow receiver to continue, do not call stop in your sender; that call sends a message to the receiver that would result in stoping the application on receiver; here is what the documentation for that method says: "Stops the running receiver application associated with the session.". On chrome senders, you can simply close the tab if you want to let the receiver continue . Note that the onSenderDisconnect now has an argument that shows whether disconnect was explicit (intentional) or not, in case you want to handle explicit disconnects differently. Other platforms, e.g. Android SDK, also have similar stopApplication methods that should not be called if you do not want to stop the running application on the receiver. On Android and iOS, you have more APIs to provide a more fine-tuned "disconnect" experience.
Related
In order to display text in the correct language on startup of a chromecast receiver app we rely on a customMessage from the sender app containing the user's language.
But this message won't be sent before the application is done starting up and we want to display it as soon as possible, so before loading is done.
I noticed that sender-apps have the possibility to set a language in castContext.setOptions(options).
https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext#setOptions
https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastOptions#language
The question is: Is there any way to get the castOptions's language on receiver side?
Or: Is there any other way to get a language from sender app before the receiver is done loading?
I am developing a voip based phone call app specially for video conferencing type calls. Everything works via normal push notifications.
how do I show incoming call screen with sound e.g.
I am trying to implement - https://developer.android.com/guide/topics/connectivity/telecom/selfManaged
not sure if I am in the right direction.
Note: I don't want to interrupt/intercept normal phone calls.
I have managed to implement this using combination of push notification, broadcast receiver, alarm service, setting window flags on activity with "FullScreenIntent".
"OnMessageReceived" set an alarm for x seconds (500ms) with Broadcast receiver
in receiver setup MainActivity intent and set flags "NewTask" and "frombackground"
In MainActivity - override "OnNewIntent", set the window flags
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
Window.AddFlags(WindowManagerFlags.DismissKeyguard);
Window.AddFlags(WindowManagerFlags.ShowWhenLocked);
Window.AddFlags(WindowManagerFlags.TurnScreenOn);
Window.AddFlags(WindowManagerFlags.Fullscreen);
this will open the app in fullscreen and can be routed to appropriate page for custom UI
I am creating an app for android to support google cast for video with interaction using CastCompanionLibrary library.
On the video VideoCastManager use and for the part of the exchange of messages (data) DataManagerCast use.
I want to implement a control who can connect to a particular session. My idea is that the first sender to connect on chromecast be the "owner of the session" and other senders need to ask permission to him to connect. I created a namespace for communication between the receiver and the sender session owner for the connection process occurs.
If the sender is not authorized then it should disconnect.
I took a look at receiver reference searching for a method to the receiver disconnect a particular sende, but it still fails. Does anyone know if it is possible to implement this my idea?
First, why are you using DataCastManager? VideoCastManager can add a data channel and that is all you'd need to communicate so only use the VideoCastManager.
As far as memory serves, receiver cannot disconnect individual senders, so an alternative to your approach would be:
Each sender, after connecting to the receiver, will send a message to receiver to register itself.
Receiver looks at the number of connected devices, if that is the first one, it considers that the owner an sends back a message to the sender letting it know that it is the owner. If it is not the first one, it sends back a message to that sender, informing it that it needs to get authorization from the owner (so the new sender knows that it should wait for an authorization). At the same time, it sends a message to the owner asking for permission to allow the second one in.
The owner will send back a message to the receiver to allow or prohibit the new sender to connect. Receiver then sends a message to the new sender to let it know if its request was granted or not.
If permission was granted, then your code in your sender would allow the user to move forward in the app. If it is not granted, then the logic in your sender app can either stop the user from going forward, or can disconnect the sender, or can just limit the stuff that teh user can do.
I'm just getting started with a simple sender app and the default media receiver. Is it possible to either:
a. send a list of images that Chromecast will loop over
b. send a single url that Chromecast will refresh on an interval, letting the server "cycle" the images through
I'd want this to continue without the sender application needing to be open. I was hoping to not have to create a custom media receiver, as I'm assuming I'd be able to do what I want to do. It seems like I'd have to implement a lot of boilerplate and register the custom application just for some fairly simple functionality.
Yes, it is possible but you need to write your own receiver to do that; the Default/Styled receivers that are available for you do not do what you have in mind.
I'm working on a custom sender & receiver for Chromecast, using a custom HTML5 player and communicating via the built-in media channel/namespace.
When sending a message from the sender to the receiver, e.g. session.loadMedia or media.pause, they are handled correctly on the receiver. However, in the sender, neither the success not the error callback are invoked. What would I be doing wrong?