Display image with Chromecast - android

I'm developing a gallery app and I want it to be compatible with the Chromecast.
I searched and tried for days but I can't get it to work. I learned that I need to create a webserver (NanoHTTPD) and send the url of the image. Can someone show me a simple tutorial?
If I have the path of the image, how can I display it in the simplest way possible?
Thank you!

There is plenty of examples and resources that show you how to cast a video, so familiarize yourself with that. Then, for sending an image, you need to follow the same steps but your MediaInfo object that represents your item (image in this case) needs to have its URL set to the url of the image, served by your embedded server (for example, if you put that url in your web browser on your laptop on the same network, you should be able to see the image). Then load that media item the same way you would load a video. For the simplest solution, you can use the default receiver; it supports images.

Related

Fetch Image without URL in Android

I'm developing an app and one of the components involves the user recording where they have gone for the day. I use some NLP to identify the location, however it would be awesome if I could also after obtaining the location or any other string for that matter get an image from an external API. I've seen people use image urls to get images for their android app but, how can I get an image without a URL, kind of of like a google images search? If this isn't possible is there a way to get an image url?
You can use Google Images Api:
https://serpapi.com/images-results

Are we allowed to make our own image uploaded in different website in our app for download?

We have our own Artwork and photography images uploaded in different websites like Tumblr,500px,Deviantart,Flickr etc.So for every image there will be already some URL which is publicly available for everybody to view or download.
Example of such a URL is : http://40.media.tumblr.com/b12772f7533b6283ca008ba8d7ec2192/tumblr_nsezua4hur1r4xqayo1_500.jpg
Like there will be a lot of URL, and we are able to show this in our app and app let user to download this URL. Since the server is not our own, But the images are our own, are we allowed to use these urls in our app to show as a gallery app and let the user download it to their own.
Is it allowed? This is related to programming, because we have seen same websites providing their own APIs to fetch data. But we dont want too many details, Our requirement is simple, So we are trying to keep it simple and economical.
You should be fine, but check that the URLs don't change, or you'll be left with a lovely little error.

android continuously downloading image from web server

I want to download an image from the web server for every 1 second. Can some one tell me the best approach to achieve this. Currently, i am thinking to use Executer class but i am not sure whether that would be a better approach or not. Please help me.
to perform this you might need use asynctask. this is my idea, retrieve all the image url from the server,then manipulate the url. you can use library such as android smart android view to display the image from the server just by only providing the image url.
android smart android view:-
http://loopj.com/android-smart-image-view/

Android - share both text and image to WhatsApp same as YouTube share function

I have been searching for a way to create a share function that share an image and text in the same time and the answers i found is that WhatsApp can only share a single text or single image or single audio .. but in another hand i found that YouTube application is able to share text and image in the same time and in one message box as shown below:
So is anyone have an idea of how to do this?!.
And thank you in advance.
WhatsApp actually recognize this link as a youtube link and gets the preview image of the video from youtube.
WhatsApp and youtube probably made an arrangement between them, when WhatsApp recognize
a youtube link it request the image from youtube servers and gets it.
You can see that if you take only the link and send it, the image will be added by WhatsApp.
unfortunately there is no way (that i know off) to share both an image and a text in WhatsApp.
Regards,
Gili
Checking the answer from Gili, what I found out is the link that YouTube share has the follow format in the Extra Text:
https://youtu.be/prkQ6QFv-_Y
So, it is quite easy to parse it and by using the YouTube API for Java, it is possible to retrieve almost all the possible information about that video and build your own layout.
Link one: How to register your app for YouTube to share the text and
capture it:
http://developer.android.com/training/sharing/receive.html
Link two: YouTube Data API for Java
https://developers.google.com/api-client-library/java/apis/youtube/v3
What I am not sure if all the version of YouTube shared text has the same format or not.

How to get image name from website?

I've not been successful in searching for this answer, but basically, how can I find the image file name from a website that blocks saving of the images? Normally, the url source will have the image filename and it is easily searchable.
However, some sites lets you hover over the picture and it then zooms to a larger image. The source shows,
for example,
http://example.com/pictures.aspx?ImagePath=ABCDEFGHIJ1234567989KLMNOPQRST==.....
E.g.: A random long string of code, but no .jpg or .png indicating the file name. When right clicking to save, it shows the image is blocked.
How can I get the images using Android code?
Tks
If it's not allowing them to be taken from a website, then it probably shouldn't be taken. That being said, there are a couple of options if you are the owner of the website.
If they are in a database then you can get the url address of them. Also, right clicking anywhere on the page to "View source" should get you some sort of URL of the image.
This seems more of a web service implementation issue rather than anything andriod specific. Many websites have this feature where you are not meant to retrieve information from the url.
However there should be a corresponding supported web service interface for fetching the metadata of a particular resource. If this is not supported then it's meant to be blocked.
The other trial and error sort of way is to invoke a 3rd party API like oEmbed (or Embed.ly : http://embed.ly/) that would return the metadata of the resource for which you have the URL. These services cover a wide range of websites and their resources.
You can search around in their site or find similar such services that would get you this information. Embed.ly is more of a personal preference due to its exhaustive list of supported sites.

Categories

Resources