I am currently using Google static map API for an Android application. For Android application it gives me the correct image but when I use the same url in a browser it gives me a image of elsewhere.
My URL:
String url="https://maps.googleapis.com/maps/api/staticmap?zoom=13&size=640x640&maptype=roadmap\n" +
"&markers=color:blue%7Clabel:S%7C6.972491, 79.917473\n"
+"&markers=color:green%7Clabel:G%7C6.962225, 79.894642\n" +
"&markers=color:green%7Clabel:G%7C6.951713, 79.917323\n"+
"&markers=color:red%7Clabel:C%7C6.912690, 79.908225\n" +
"&path=color:0x000000|weight:3|6.972491, 79.917473|6.962225, 79.894642|6.951713, 79.917323|6.912690, 79.908225\n"+
"&key=key";
Image I received:
Related
I'm developing an app with Android Studio, I'd like to create a RecyclerView where I have an ImageView and upload a static image of a determining point on the map.
Like here: https://developers.google.com/maps/documentation/maps-static/intro
I tried to use this method with Picasso (Library that takes an image of a url and loads an ImageView) but nothing happens, with other urls of images on the internet that I used to test it worked and loaded in ImageView but with that nothing appears:
imageMap = findViewById(R.id.imageMap);
String lat = "-12.958811";
String lon = "-38.401606";
String url ="https://maps.googleapis.com/maps/api/staticmap?";
url+="&zoom=14";
url+="&size=330x130";
url+="&maptype=roadmap";
url+="&markers=color:green%7Clabel:G%7C"+lat+", "+lon;
url+="&key=MY_KEY";
Picasso.get().load(url).into(imageMap);
Does anyone know how to do this? With this or another method?
I have tried the methods in other posts reporting this problem but my url is correct in relation to the others.
Make sure you're using the right API key (use the one specifically for Android) and get a more detailed stacktrace by adding a simple success/error callback: Android: Picasso load image failed . how to show error message
You need to enable the billing option in your project. Google change the payment methods and now you need to enable this option in order to use some APIs.
I want my app to give sample images based on what the user typed.
I created a custom search engine, already ticked "search entire web but emphasise...", and ticked "Image Search".
Created an html GET request as per Google's instructions.
String start = "start=0";
// looking for
String strNoSpaces = toSearchIn.replace(" ", "+");
String url2 = "https://www.googleapis.com/customsearch/v1?"
+ "key=" + keyBrowser
+ "&cx=" + cx
+ "&q=" + strNoSpaces
+ start
+ "&searchtype=image"
+ "&alt=json";
return url2;
and it all works well, I retrieve the image URLs and inflate the grid view.
The problem is the quality of results. It is nowhere near the relevance of what you see on the main google.com search results, and it was kind of my goal. The results that I am getting are rather disappointing and make the whole feature not worth it.
For comparison
my "party" results
Normal search results
Can this be changed with some parameters? I already tried most of them without much difference
I have uploaded a file on google drive, i have made it public. i am able to access this on browser but not with my android app.
I need to access this public link on MY ANDROID APP.
PFB the link of file:
https://drive.google.com/file/d/0B56C1LC3IVXCV055WFIyVTZjTTA/edit?usp=docslist_api
Is this possible to access a publicly shared GD file on android app?
Code snippet is
URL url = new URL("https://drive.google.com/file/d/0B56C1LC3IVXCV055WFIyVTZjTTA/edit?usp=docslist_api");
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
return bmp;
The solution is to format the address of the document you have shared.
Check this :
URL = "https://docs.google.com/uc?id=" + IDFile + "&export=download";
Your link is not to image but to Google Drive App with this image opened, real URL to image is this
Consider using Google Drive API
How about scaling the picture down to a reasonable size, it may just be that the image is too large for your heap to load
Bitmap.createScaledBitmap(Bitmap src, int Width, int Height, boolean filter)
There one other way to access file's public link By adding :
https://googledrive.com/host/[folderId]/fileName.extension
As you have provide file url
You can use that url like this for public access
https://googledrive.com/host/0B56C1LC3IVXCV055WFIyVTZjTTA
You simply need to grab the webContentLink of the newly created file.
From the documentation ...
webContentLink string
A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials.
I want to know how to upload multiple photos at a time thru google plus?
I found how to upload one photo and one message at a time from google plus sample code.
String action = "/?view=true";
Uri callToActionUrl = Uri.parse(getString(R.string.plus_example_deep_link_url) + action);
String callToActionDeepLinkId = getString(R.string.plus_example_deep_link_id) + action;
// Create an interactive post builder.
builder = new PlusShare.Builder(this, plusClient);
// Set call-to-action metadata.
builder.addCallToAction(LABEL_VIEW_ITEM, callToActionUrl, callToActionDeepLinkId);
// Set the target url (for desktop use).
builder.setContentUrl(Uri.parse(getString(R.string.plus_example_deep_link_url)));
// Set the target deep-link ID (for mobile use).
builder.setContentDeepLinkId(getString(R.string.plus_example_deep_link_id),
null, null, null);
// Set the message.
builder.setText("user message");
// Set the image
Uri uri = Uri.fromFile(new File("[user file path]"));
builder.setStream(uri);
Anyone knows about uploading multiple photos like facebook and twitter?
It should work with addStream() method, unfortunately... it doesn't work. Indeed it makes the application crash.
After a long search, I finally got it: it's not possible if using the simplified G+ SDK! (the one dedicated to Android).
There is a second one, included in the Google API family that you can find there:
http://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API
This one will let you build more advanced post, included, several pic one.
Unfortunately the second SDK is much more low level, not dedicated to Android, it's a kind of Java abstraction over http request.
Regards
This code WAS working fine, but suddenly stopped showing the map thumbnail from either Bing or Google static maps.. Any ideas? Did Facebook change their own parsing of the picture urls?
Bundle parameters = new Bundle();
parameters.putString("message", et_message.getText().toString());
parameters.putString("description", "Currently Near");
parameters.putString("picture","http://maps.google.com/maps/api/staticmap?center=36.837812,-76.022045&zoom=15&size=110x110&sensor=false&maptype=hybrid&markers=color:blue|36.837812,-76.022045");
parameters.putString("caption", lStreet + " - " + lCity +", "+ lState + " : "+ lPhone);
parameters.putString("name", lName);
if(lUrl != null){parameters.putString("link", lUrl);}
mAsyncRunner.request("me/feed", parameters,"POST", new myPostListener(), 1);
Now the Wall Post on my Facebook seems to be changing the link to combine parts of the LINK url, along with the image URL. I don't have a clear example of this that I can post, but a rough example is:
link = http://foo.bar/
picture = http://somemaps/image1.jpg
Result when hovering over the broken image on Facebook is something like:
http://apk.facebook/http://somemaps/image1.jpg
I don't get why Facebook isn't just using my raw picture Url in the first place!? Grrrrr
Anyone else having problem posting images to facebook wall, where image is a realtime generated image from Bing Maps, or Google Static Maps API?
I was having a similar issue and after a long debugging session it was due to me not providing a link and name attribute along with the picture attribute. I was just sending in message and picture but I think Facebook changed the way you can post pictures in a post recently because this did work about a month ago when I was testing.... Make sure they are all included in your post to Facebook. To post a picture you have to post to /me/photos, can't just send in a link unless you want it displayed as a "Facebook Link". Hope that helps.