开发者

sharing feature in android

Is it possible to share my video or my photo from my application on the web in android?If possible how to do this? I made a application and now i want to s开发者_运维技巧hare some my feature on the web so how i can do it? Thanks


Depending on what exactly you mean, it’s possible that this functionality is already built in. Using the ACTION_SEND intent allows the system to coordinate activities to share arbitrary kinds of data. Applications exist that can send images and videos to Twitter, YouTube, Picasa, MMS, Bluetooth, etc.

Something like this (untested) will inform the system that you have an image to share:

Intent msg = new Intent(Intent.ACTION_SEND);
msg.setType("image/jpeg");
msg.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/foo.jpg"));
startActivity(Intent.createChooser(msg, "Share image"));

Now, if you want your application to send images specifically to your web service, you can still use this send intent, but also include an activity that can handle this sort of request. If you still use the intent chooser, the user will have the advantage of being able to send their images and videos to other places besides your web service, and your application will feel like an integrated Android app. On the other hand, bypassing the intent chooser and just uploading it directly makes your app feel more streamlined but less flexible.

The Android API includes the org.apache.http framework for talking to web services.


@rbads, this is an old question so i don't know if it's still pertinent, but you can also share with Socialize -- www.GetSocialize.com. We use the concept of "entities" and have likes, comments & sharing around each entity (entity = unique piece of content in your app).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜