Is it possible to have a Chromecast sender application to pass custom data to the receiver in the URL? The goal is to pass user-specific data to the receiver so it can generate the appropriate contents each time it's called.
An example of this would be a simple to-do list. When the user casts to their device, that user's data should be passed via URL to the receiver so that their task list can be loaded in the custom receiver.
I haven't seen any tutorials or much information on this in the Cast documentation.
If you mean passing parameters as part of the receiver url that loads the receiver, the answer is no; there is no such thing. You can either use the customData that can be passed to the receiver in a number of APIs, or you can create a custom data channel if the former is not adequate for your needs.
The Cast receiver URL is specified as a static URL when you're registering/publishing the app on the Google Cast SDK Developer Console so it is not possible to add custom parameters.
However you can use the Cast Messages system to send data between a Cast sender and Cast receiver. It's similar to the messaging system in modern browsers.
Related
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 am developing a Google Actions project for Google Home using api.ai.
Is it possible to pass a state parameter as part of the response to api.ai and have it included in the next request?
The Amazon Alexa API handles such a flow and it came in handy.
Thanks
EDIT:
I did not mention this before: I have api.ai sending requests to a webhook after google assistant triggers my intents. The response api.ai expects is defined here. I've tried including extra fields in the response but these are not included in any future intent requests from api.ai. I've also tried adding fields and values to the google specific portion of the response (defined here) to no avail.
As an example of what I am interested in, when responding to Alexa requests we can include a json field "sessionAttributes" which are then passed by Amazon in any future requests that are part of that interaction.
In this instance I query a database key on the first intent (which is subsequently used to pull a record) and pass that key in sessionAttributes to avoid performing that lookup for every intent request I receive.
The equivalent that you are looking for to sessionAttributes in Alexa dev depends on whether you are using an API.ai webhook or a conversation webhook. Reference this doc for more info on the differences.
Since you are using API.ai, assuming you are using the Node.js client library, use the snippet below. 'Contexts' can store data, not just serve as a flag of sorts to establish where you are in a conversation. Call setContext just before you call 'ask' and close out your webhook fulfillment.
app.setContext('<context name>', <lifespan of context>, <JSON to store>)
Then for the next round of fulfillment, retrieve the JSON from the parameters object within the Context. Get it with:
var myContext = app.getContext('<context name>')
Reference the examples in these docs for more info.
You could create an optional parameter in API.ai to catch/store this value and append any message being sent to API.ai with a marker and then the database value you want to cache, so API.ai recognizes from the marker the value to be cached as the parameter, and this would be passed back out of API.ai as well, so if you needed to chain/loop this, on your side you again just check if it has the special 'append' parameter value to append that to the next user message.
That being said, contexts can likely achieve the same end-goal you are trying to achieve in a much more straightforward fashion
I am trying to launch glympse app by using an intent and receiving the information through broadcast. Is there any way that I will be notified about the events occurring like ticket removed, expired, updated etc?
There sure is.
We created a library project to make this easier for you. It can be found here: https://github.com/Glympse/glympse-app-sdk/tree/master/Android/GlympseIntentsLib
A sign-in is required to view these documents that might be helpful.
Tutorial: https://developer.glympse.com/Content/client/app/guides/Glympse_Intents_Tutorial.html
Reference Docs: https://developer.glympse.com/Content/client/app/guides/Glympse_Intents_Reference.html
Specifically, check out the method CreateGlympseParams.setCallbackAction(String). This will allow you to set an action which will be used to broadcast a message back to your app.
Another option is to use CreateGlympseParams.setEventsListener(EventsListener). With this method, you can supply an object that implements GlympseApp.EventsListener. Using this method, our library handles the broadcast under the covers and your object's methods will be invoked as the event occur.
When I register a Chromecast receiver app, it asks for a URL. Is that where the receiver html file is?
Either you need to use one of our receivers (Styled or Default), in which case you do not need to register any URL or you need to use your own custom receiver which requires you to arrange for its hosting. See tour docs.
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.