Send image from Android to Sony Smart Watch 2 - android

I am working using the Smart Watch 2 API. Now i can send text message to the SmartWatch with no problem. I used this guide to get the before behavior working with not problem at my end http://www.kpbird.com/2013/12/sony-smartwatch-app-development-3.html.
Now, for project requirements, i need the capability to send an image and display it on the SmartWatch, i research a lot about how to get this working properly but not success on my end.
If possible, do you have some source example of how to get this capability, to sending an image to the SmartWatch and display it or if you know some guide or documentation that can help me to find the best approach to do this.
Thanks!

Could you use IMAGE_URI in HelloExtensionService.addData()?
String image = ExtensionUtils.getUriString(this,R.drawable.YOUR_IMAGE); // Add
String profileImage = ExtensionUtils.getUriString(this,R.drawable.ic_launcher);
ContentValues eventValues = new ContentValues();
eventValues.put(Notification.EventColumns.EVENT_READ_STATUS, false);
eventValues.put(Notification.EventColumns.DISPLAY_NAME, name);
eventValues.put(Notification.EventColumns.MESSAGE, message);
eventValues.put(Notification.EventColumns.IMAGE_URI, image); // Add
eventValues.put(Notification.EventColumns.PERSONAL, 1);
eventValues.put(Notification.EventColumns.PROFILE_IMAGE_URI,profileImage);
eventValues.put(Notification.EventColumns.PUBLISHED_TIME, time);
eventValues.put(Notification.EventColumns.SOURCE_ID, sourceId);

To display an image on SW2, you will need to use the Control API. You can use the showBitmap() method to show the image.
http://developer.sonymobile.com/reference/sony-addon-sdk/com/sonyericsson/extras/liveware/extension/util/control/ControlExtension#showBitmap(Bitmap)
For a sample project, take a look at the HelloLayout sample code in the Sony Add-on SDK.

Related

Android reverse image search

In my project i need to include searchs to a API Rest to query with a url that points to a jpg picture and it returns a list of urls with similar pictures.
Google Images performs via web like i am looking for, but the clients for Android that i have found (github projects) they work simply with an input text.
The simplest code would be something as below:
String inputUrlPic = "https://cdn.pixabay.com/photo/2014/03/14/20/13/dog-287420__340.jpg";
String[] returnedUrlPictures = null; //list of returned pictures similars to inputUrlPic
ReverseImageApi reverseImageApi = new ReverseImageApi();//My desired Api object
returnedUrlPictures = reverseImageApi.findSimilarPicturesFromUrl(inputUrlPic); //Ok, it would be an asynctask
So, my question is, exists a API or an Android client API to perform in this way?

Get Larger Image From Facebook Post?

I'm currently getting the newsfeed of a Facebook user. Currently, I can only retrieve thumbnail images that are associated with links, rather than the full-size image. Does anyone know how to get a larger image?
I've looked at the following posts and tried their solutions; however, the posts seem outdated and the facebook graph api seems to have changed since then:
Facebook Graph API Change: Picture type (size) no longer working?
Facebook API post: How to get larger thumbnail?
Please note that I'm on the me/home edge, so the answer below returns an error. See comments below.
my code is:
params.putString("fields","id,actions,application,caption,created_time,description,from,link,message,message_tags,"
+ "name,object_id,picture,place,source,status_type,story,updated_time,type,status_type,story,to,type,"
+ "updated_time,with_tags");
Change to this:
params.putString("fields","id,actions,application,caption,created_time,description,from,link,message,message_tags,"
+ "name,object_id,full_picture,place,source,status_type,story,updated_time,type,status_type,story,to,type,"
+ "updated_time,with_tags");
Here picture.height(1000) will give you a large image. and you can put your own required size but it is not supported in me/home i have searched a lot.
For Testing purposre use this link :Facebook graph explorer.
Eventually I came to this solution:
1) find the URL of the larger image (see code below)
2) get bitmap from URL and add to application UI.
The code mentioned above:
private String getRealURL(String smallURL){
if (smallURL.contains("url=http")){
String[] pieces = smallURL.split("url=");
pieces[1].replace("%2F", "//");
pieces[1].replace("%3A", ":");
Log.e("RealURL1:", pieces[1]);
return pieces[1];
}
else{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.setLength(0);
stringBuilder.append("https://graph.facebook.com/");
stringBuilder.append(item.getObjectID());
stringBuilder.append("/picture?type=normal&access_token=");
stringBuilder.append(Session.getActiveSession().getAccessToken());
Log.e("RealURL2:", stringBuilder.toString());
return stringBuilder.toString();
}
}
Simply use this field ?field=full_picture instead of picture.
?field=full_picture is the only way to get it to work now. I have been searching everywhere, and finally found the answer here. picture field doesn't support subfields any more so you can't use picture.width.height any more

Get the latest Changes from dropbox

I'm developing dropbox image downloading application in android
i have no idea how to identify dropbox image changes using /delta as mentioned in dropbox
can you please give me any reference tutorials or any explanations specially what is cursor parameter and how to parse it
The first time you call delta, you don't pass a cursor. The response includes a cursor that you should use on your next call, and so-on.
I have did this as following way
DeltaPage<Entry> deltaPage;
String cursor ="";
do {
deltaPage = mApi.delta(cursor);
cursor = deltaPage.cursor;
if(..){
..
}
} while (deltaPage.hasMore);
please note that "mApi" is a reference for "DropboxAPI"
to reach the answer I have used following links also
download dropbox api for android
documentation for delta in the Android Core SDK
link 1
link 2
link 3
how to use delta in general
when i was in trouble Mr.Gregory from Dropbox support has sent me these links and it was very helpful for me.. I hope they will hope you also..
cheers.. happy coding

How can I upload multiple photos in one post on Google+ from G+ Android SDK?

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

Android Photo Viewer Demo

I've been trying to figure out how to display a photo on Android. I can create an ImageView and display a picture, but the functionality is limited (no zoom, pan or share). Is there a demo or tutorial with code out there on how to do this? I've been searching all week with no luck.
Thanks.
P.S.> Please No Snark!
Maybe I don't understand how to create a uri correctly or how to make my resource available to the viewer. I have a resource ID, R.drawable.opal, I'm using to display different minerals and gems for a science project. If the student clicks the small sample photo, then I want to bring up a bigger and better viewer for the photo to allow them to compare to their collected rock.
Unless you really need to build your own you should probably just use the gallery's viewer. Send it the picture by using the view intent like so:
Intent viewImageIntent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(viewImageIntent);
Replace "uri" with the image's uri of course. Writing your own viewer is really involved and would include threading, physics calculations and handling touch inputs.

Categories

Resources