Get language on startup of chromecast receiver app - chromecast

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?

Related

How ChromeCast Communicate with reciever app and sender App?

As we know we send and receive message in json form from send app to receiver app. what is the proper channel for sending and receiving message and what role ChromeCast play in whole picture?
Senders and receivers are establishing a socket connection and communicate via IPC. While it's true that this communication is in JSON format, you will likely neither generate that data yourself nor care about the 'how' or 'channels' of it - in fact, you are not even allowed to following the terms of service by Google.
Instead, you have the SDK handle that for you one both the sender and receiver site.
Communication is done in the form of defined Messages that implement a schema and contain objects - most notably for media playback that is MediaInformation.
Most of those objects that are passed between sender and receiver have a customData property that you can use to add self-defined payload in JSON format.
If you want to implement your own features you can implement custom messages.

I can send Google Assistant messages to my windows application, but how do I send a message back?

I'm using IFTTT to send a Google Assistant message to my Windows application via Drop Box. If I say "[keyword] [message]" (for example: "Computer: Play Game of Thrones Season 2 Episode 4") IFTTT will write the text translation of [message] to a file on drop box that my application monitors and from there I can read the [message] and act on it.
What I would like to be able to do is send a reply back to the device that sent the message... For example if I tell my phone to have my computer start a movie on my computer and for whatever reason my app can't find the movie I want to be able to communicate that back to the device that originally sent the message, whether that be my cell phone or tablet or Google Home smart speaker.
I know there is probably no official way to do this but i'm looking for creative solutions (like the one I use to get the message in the first place)... anything at all that works even if it involves multiple third-party services.
There's no good way to send back an acknowledgement through the IFTTT integration. You'd need to build your own Action which would use something like push notifications to communicate between your local device and a cloud-based webhook.

Is there a Cocoa way to pass information between two sandboxed apps?

I'm writing two sandboxed macOS apps that operate like a "server" and "client", in that one runs in the background with authoritative logic and data, and the other runs transiently in the foreground with a dummy view that will ask the background app what it should do.
The most promising prospect so far was DistributedNotificationCenter, but I was deflated when I saw that the documentation for posting
a notification says:
Important
Sandboxed apps can send notifications only if they do not contain a dictionary. If the sending application is in an App Sandbox, userInfo must be nil.
So it seems that DistributedNotificationCenter can only be used to send the notification's name across processes. How disappointing! It does say something about a notificationInfo dictionary, but not how to set that or use it, so I assume that's a typo meant to be userInfo.
True to its claim, even when I add the com.apple.security.application-groups entitlement to both apps with the same value for each, it fails when I try to call postNotificationName with a userInfo dictionary, printing the following to the console:
2017-07-26 11:45:44.168865-0400 Foreground App[49005:1967499] *** attempt to post distributed notification 'me.benleggiero.incomingBackgroundServerRequest' thwarted by sandboxing.
Is there a Cocoa way to send arbitrary data between apps? It doesn't necessarily have to be secure; I can ensure that independently. I'm just trying to avoid setting up sockets and other C stuff like that.

How can I display an endless loop of images via Google Cast?

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.

Localize notification payload

I am currently developing a localized application which uses push notifications. I would like to know if it is possible to localize the strings that are sent in the notification message, in the Text element for toast notification and in the Title element for a tile notification. I would like to use the localized resource strings I have created to localize the rest of the application.
I have seen that it is possible to localize the application title by using the '#' character in the main tile by following this guidance:
http://msdn.microsoft.com/en-us/library/ff967550(v=VS.92).aspx
but unfortunately I do not know if this behaviour can be reproduced whilst receiving a push notification. So finally, is there a way to localize push notifications?
I also posted this issue on the msdn site:
http://forums.create.msdn.com/forums/t/96082.aspx
Therefore I will implement l8n on the server side as it seems to be the only way to localize notifications' payload.
Thank you Heinrich.

Resources