How can I programmatically show the select device dialog? - google-cast

I am using the Cast Companion Library and most of it is working well however I have not been able to figure out how to show the device chooser programmatically.
Basically when a user chooses a video on my app I would like to show the chooser if they haven't yet connected.
Thanks.

If you are using the MediaRouteButton and it's accessible:
mediaRouteButton.performClick();

you need to "Developing a custom UI with the MediaRouter API’s and MediaRouter.Callback" but I didn't find any example how to do it .

First, I suggest you do not do that. I don't know what you are planning to do in your app so I can't say much but don't do something custom in terms of user interaction/flow that is different from other apps and the apps offered by the framework; people will not expect that.
On the technical side, if you want to open the standard dialog, I am not aware of any trick but I haven't looked at the MediaRouter code in v7 support library for that; since that is open source, you are welcome to look in there and see if there is any simple way to do that. If you want to design your custom one, you should be able to do that; the CastCompanionLibrary provides a sample of the Callback dialog and the one for chooser follows a similar pattern.
As a side note, you mentioned you want to open the chooser when user selects a movie. So how can they select to play locally? Are you planning to add additional selection to that dialog for local playback?

Related

How i can make a code in dialogflow that open the camera and take a picture?

i'm new in the chat bot programming . I would like to do exactly the command "ok google, take a picture", that the android open the camera and in 3 second take the pic. Dialogflow is a service from google, so I thinking that there are some library with some example of this, or if not, how I need to search to put this command in my action ?
PS: I'm making a location and opinion action that receive from the user the place and the opinion about the place, so i would like to ask if the user want to take a pic from the place using this, but a don't know how a search this!
Unfortunately, there is currently no library and no direct support for this type of thing. The Assistant does not give Action developers access to the camera. In fact, most of the work your Action does is on a cloud-based server, not on the device itself.
You can, in some cases, use something like the Android Link helper, but this requires the user to have installed your app on their phone, and doesn't quite do what it sounds like you want.

How can I allow users to change their Liferay portrait from a velocity template?

I´m coding a template for a customize theme and would like to let users change their Liferay portrait from there. In addition, it would be nice to add the functionality provided in the "official" window that gives the possibility to select a part of the uploaded image.
The simplest way I can imagine to do this is "building" a link that directly brings the user to that window without having to pass through his profile. Right now, I´m trying to do this with the JS function "Liferay.Portlet.openWindow" but still I haven't been able to find the correct arguments (including the large URL) to accomplish it.
Is what I´m trying to do possible? if so, could you help me?
I think that the best solution to that would be to build a custom liferay MVC or Vaadin protlet to do just that.
This is because the friendlyURL (large URL as you called it) to take a user to that place is usually generated on the fly within the portal instance so you may not have the correct redirection.
Also you would have to use the method ImageLocalServiceUtil which is used to upload images to do the actually portrait change.

Xamarin.Forms + Custom Renderers vs. Xamarin.iOS/Xamarin.Android

I recently started using Xamarin.Forms for a project. Like the documentation mentions, it's great for prototyping. However, I'm really starting to notice limitations of the shared concepts for UI design. In particular, the inability to set custom button content (such as an image) is aggravating. I'm sure there will be several instances where I'll want to change how controls work.
The way I see it, there are two routes I could take. One, continue using Xamarin.Forms and make use of custom renderers. Considering I would still like my UI code to be shared, but also customized from the basic Xamarin.Forms controls, I'm leaning towards this option. Two, use the native Xamarin projects (Xamarin.iOS, Xamarin.Android). This would give me full control over the UI for each platform, but it would also mean more code to maintain.
Like I mentioned, I'm currently favoring the option to use custom renderers with Xamarin.Forms. Could I get some insight from those who have used one or (preferably) both options?
I've mainly used Xamarin.Forms. For the right kinds of apps (ones that are, well, "Forms"-like), it works pretty well.
Writing custom renderers isn't that hard, but the documentation is, unfortunately, not that great. Depending on what you're doing, it can be a bit tricky at times translating between the native control and the Forms layout engine. However once you get the hang of it, it makes sense, and now that the code is open source, you can peek inside to see how the "built-in" controls work.
There are various extensions that add more controls. Some are free and open source, like XLabs.Forms. So the control you need might be out there already.
You can use mechanisms like TapGestureRecognizer to turn an Image or a Label into a button, so just because the built-in Forms Button is really, really lacking in customizability, you can sometimes find other ways to get the same effect and still stay within pure Xamarin.Forms.
Hope that helps!
XamarinForms is good for sample application who don't need to use a lot of specificity of the device.
For complex applications, I advise you to start on Xamarin Ios and Android.
It will take more time to take charge but you will see it is much more permissive

Control xml attributes

Hello I have a problem wich I would like to find the perfect solution for it.
I am a publisher in many monetizing platforms like : admob,adfonic..
for example in my main layout.
I declared admob but if I wanna show adfonic I must do a whole update of my app vercion for my users would see adfonic instead.
So is there anyway of control those lines or controling that xml that shows either admob of adfonic ?
Thank you very much
I strongly recommend using a mediation solution like Admob mediation where you can configure which networks to use at runtime.

Use hardware search button

I have experience with Android's search functionality as described here: http://developer.android.com/guide/topics/search/index.html, but haven't been able to find anything similar for windows phone 7.
Alternatively, what is the best approach to provide search functionality within your windows phone application?
The search scope is within the application itself, and while it is obviously possible to implement it myself, I'm looking for something that follows the ui guidelines of windows phone 7, and possibly also an interface to provide search results from the app, even when the search button is pressed while the app is in the background.
You are fully responsible for handling search within your app. There are no WP7 specific guidelines or tools available. Do what's best within the context of your app.
You cannot integrate with the built in search facility to include app specific results with anything returned as part of a bing search.
To add, interface to Windows Phone 7 hardware search button is not exposed to third party developers. You need to provide your own search button in the application and handle it appropriately.

Resources