Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
The Facebook ACTION_SEND problem
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Wyszomierski  
View profile  
 More options Dec 16 2009, 6:19 pm
From: Mark Wyszomierski <mar...@gmail.com>
Date: Wed, 16 Dec 2009 15:19:49 -0800 (PST)
Local: Wed, Dec 16 2009 6:19 pm
Subject: The Facebook ACTION_SEND problem
Hi,

Trying to a share a bit of text using ACTION_SEND. Facebook will popup
as an app capable of handling this, but fails to handle the intent
correctly. Using this:

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent .setType("text/plain");
    intent .putExtra(android.content.Intent.EXTRA_TEXT, "This is a
test.");
    startActivity(Intent.createChooser(intent, "testing..."));

I read that the problem is that while Facebook has registered as
supporting text/plain, it can only actually deal with urls.

If this is really a problem, is there a way I can somehow explicitly
remove Facebook from the list of applications that can handle my
ACTION_SEND request? Or somehow modify my intent to specifically deal
with Facebook?

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Murphy  
View profile  
 More options Dec 16 2009, 6:24 pm
From: "Mark Murphy" <mmur...@commonsware.com>
Date: Wed, 16 Dec 2009 18:24:12 -0500 (EST)
Local: Wed, Dec 16 2009 6:24 pm
Subject: Re: [android-developers] The Facebook ACTION_SEND problem

I don't know about the latter. If you are willing to roll your own
chooser, the former should be possible. The underlying PackageManager
methods that support the chooser, such as queryIntentActivities(), would
allow you to find miscreants and filter them out of your list. You'd need
to present that list to the user, though.

--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Wyszomierski  
View profile  
 More options Dec 16 2009, 6:37 pm
From: Mark Wyszomierski <mar...@gmail.com>
Date: Wed, 16 Dec 2009 15:37:28 -0800 (PST)
Local: Wed, Dec 16 2009 6:37 pm
Subject: Re: The Facebook ACTION_SEND problem
Ok so I can get a list of names which will match my intent with the
following:

  // Get apps which can handle text/plain (or at least claim to).
  Intent sendIntent = new Intent(Intent.ACTION_SEND, null);
  sendIntent.addCategory(Intent.CATEGORY_DEFAULT);
  sendIntent.setType("text/plain");
  PackageManager pm = getPackageManager();
  List<ResolveInfo> activityList = pm.queryIntentActivities
(sendIntent, 0);

and this will give me (on my phone):

  com.android.mms.ui.ComposeMessageActivity
  com.twidroid.SendTweet
  com.facebook.katana.ShareLinkActivity
  com.google.android.gm.ComposeActivityGmail

so yeah I can see facebook is handling it with ShareLinkActivity (and
I ain't sharing a link). So knowing this, I suppose I could build my
own picker dialog, and specifically modify the intent for facebook by
supplying only a url, instead of real text.

How could I find the cool little icons that each app uses to go with
my own picker dialog? I don't like doing this, I wish they did not
implement facebook like this..

Thanks

On Dec 16, 6:24 pm, "Mark Murphy" <mmur...@commonsware.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Wyszomierski  
View profile  
 More options Dec 16 2009, 6:40 pm
From: Mark Wyszomierski <mar...@gmail.com>
Date: Wed, 16 Dec 2009 15:40:15 -0800 (PST)
Local: Wed, Dec 16 2009 6:40 pm
Subject: Re: The Facebook ACTION_SEND problem
Oh looks like this will work:

  List<ResolveInfo> activityList = pm.queryIntentActivities
(sendIntent, 0);
  for (int i = 0; i < activityList.size(); i++) {
    ResolveInfo app = activityList.get(i);
    Drawable d = app.icon;
    Log.e("###", "Name: " + app.activityInfo.name);
  }

I'll put together a picker dialog to handle this and post it
afterwards, if someone could spot-check it that would be great,

Thanks

On Dec 16, 6:37 pm, Mark Wyszomierski <mar...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Murphy  
View profile  
 More options Dec 16 2009, 6:41 pm
From: "Mark Murphy" <mmur...@commonsware.com>
Date: Wed, 16 Dec 2009 18:41:12 -0500 (EST)
Local: Wed, Dec 16 2009 6:41 pm
Subject: Re: [android-developers] Re: The Facebook ACTION_SEND problem

> How could I find the cool little icons that each app uses to go with
> my own picker dialog?

getApplicationInfo() or getActivityInfo() on PackageManager should have
what you need.

You can also take a look at my Launchalot sample for some ideas:

http://github.com/commonsguy/cw-advandroid/tree/master/Introspection/...

> I don't like doing this, I wish they did not
> implement facebook like this..

Ideally, there would be a MIME type for URLs, but I'm not aware of one.

--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CraigsRace  
View profile  
 More options Dec 16 2009, 6:51 pm
From: CraigsRace <craig...@gmail.com>
Date: Wed, 16 Dec 2009 15:51:34 -0800 (PST)
Local: Wed, Dec 16 2009 6:51 pm
Subject: Re: The Facebook ACTION_SEND problem
FYI: This is really a bug with Facebooks Facebook app (it incorrectly
directs to the mobile link sharing).  If you use ACTION_SEND and chose
other Facebook apps (I think I tested FBabble), it works.

On Dec 17, 10:41 am, "Mark Murphy" <mmur...@commonsware.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Wyszomierski  
View profile  
 More options Dec 16 2009, 6:57 pm
From: Mark Wyszomierski <mar...@gmail.com>
Date: Wed, 16 Dec 2009 15:57:21 -0800 (PST)
Local: Wed, Dec 16 2009 6:57 pm
Subject: Re: The Facebook ACTION_SEND problem
@Mark
Thanks for the link, that's basically exactly what I need to do this.

@Craig
Yeah, it definitely looks like an issue with the Facebook app. I have
to find a workaround for this, my users will just think it's a bug
with my app rather than Facebook. One other benefit is that I can use
this workaround to possibly customize the text sent to some of the
well-known twitter apps (shorten to ~100 characters). Of course, I
guess this only works if their package names stay the same.

Thanks

On Dec 16, 6:51 pm, CraigsRace <craig...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Wyszomierski  
View profile  
 More options Dec 17 2009, 12:33 am
From: Mark Wyszomierski <mar...@gmail.com>
Date: Wed, 16 Dec 2009 21:33:12 -0800 (PST)
Local: Thurs, Dec 17 2009 12:33 am
Subject: Re: The Facebook ACTION_SEND problem
To follow up on this, the code that Mark provided pretty much has
everything you need to do the filtering. When the user clicks an item
in the presentation list, Mark has something like:

  ResolveInfo launchable = mAdapter.getItem(position);
  ActivityInfo activity = launchable.activityInfo;
  ComponentName name = new ComponentName
(activity.applicationInfo.packageName, activity.name);

and you can do something like this to check if it's the Facebook app:

  if (activity.name.equals("com.facebook.katana.ShareLinkActivity")) {
     // modify intent data EXTRA_TEXT to only contain a link for
example.
  }

of course you're back to seeing the bad behavior again if facebook
releases an update and changes that package/activity name,

Thanks,
Mark

On Dec 16, 6:57 pm, Mark Wyszomierski <mar...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »