13

I've been looking for a way to share information to social networks. I've found 2 possible solutions:

  • Look for installed apps and sent an intent (like android uses in it's gallery)
  • Use the socials network api

When looking for quick ways to implements i say use the installed apps for that but if it goes customization and generalization i think the second option is the best.

I've a hard time deciding if one outweighs the other or not.

So my question is: What is the best approach? One of the ones i suggested or a whole different way?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Nick
  • 1,733
  • 1
  • 14
  • 24

4 Answers4

15

The Android OS uses intents to do this... While searching for an answer to this question I came across:

Social sharing on mobile

Quoting @NewProggie

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg") // might be text, sound, whatever
share.putExtra(Intent.EXTRA_STREAM, pathToPicture);
startActivity(Intent.createChooser(share, "share"));

Depending on the MIME type you put in for setType, the chooser will show email, gmail, SMS, twitter, facebook, flickr, or whatever!

This is the easiest way to share content for the developer, and a proven method.

Community
  • 1
  • 1
Evan Leis
  • 494
  • 5
  • 13
7

I have worked with the Facebook API and I know that it's a really good one. It looks if a native Facebook app is installed, if not it pops a little popup on your screen where it does it things, if yes, it uses that app to do your things.

I think you have to take the same approach for all your Social Networks: check if app exist. if yes, use. if no, use own implementation

Galip
  • 5,435
  • 10
  • 37
  • 47
  • So basically you're saying use both ways? I get this is probably the best way, but it is definitely the most work. Not to mention you already have the api so why still use the other way? – Nick Jan 11 '11 at 10:42
  • In the case of Facebook it's nothing. Just add the .jar file to your project, initialisize Facebook (`Facebook facebook = new Facebook(bla, bla2);`), `facebook.doSomething();` and you're done. It checkes, log's on, creates layouts, etc. automatically. What I'm saying is that you need to implement the API anyways because not everyone has the native apps installed. Just add a check if it exists and if so, use the native app. – Galip Jan 11 '11 at 10:49
  • alright, i'll go with that then, thanks. Didn't know the api was that easy. To be honest i've not even looked it it yet and just assumed it was much more complicated. – Nick Jan 11 '11 at 10:57
2

You might also check Socialize out http://www.GetSocialize.com . Full feature list at http://go.GetSocialize.com/features It'll let you share social actions in the app out to social networks (currently Facebook; Twitter coming this month, then likely Google+ after that).

0

What about the case when user does not have specific social network API installed? Then you are left with only using the API. Some might argue that if user doesn't have facebook app installed, he should not be able to share stuff on facebook, but I for example use facebook throught their mobile site, I won't waste precious space on my G1 for the hefty facebook app.

I'd go with using the API.

Axarydax
  • 16,353
  • 21
  • 92
  • 151