6

This SO post addresses how to customize the UIActivityViewController by excluding services like AirDrop or printing.

It also mentions this Apple doc which highlights the stock services supported, but how do we identify other supported end points like Line and other messaging apps?

Specifically:

(1) Do Skype, Kakao, Line, Viber, WeChat, Kik, WhatsApp, and Facebook Messenger (not Facebook proper) have end points?

(2) What are those end points?

Community
  • 1
  • 1
Crashalot
  • 33,605
  • 61
  • 269
  • 439

3 Answers3

10

You can't do that currently on iOS 7, because no application can talk directly to other applications yet for security reasons. One of the highlights of the last WWDC was the introduction of extensions for iOS 8, which will make this possible; you can read how in the Creating Action Extensions example.

There are however attempts at fixing this. A notable example is IntentKit, which works by having a repository of known apps.

What is IntentKit?

IntentKit is an open-source iOS library that makes it easier to link to other apps. It's sort of like Android's Intents or Windows Phone's Contracts.

Another example of one of such attempts is OvershareKit

Why OvershareKit?

Sharing is far too cumbersome to implement on iOS. UIActivityViewController is too limiting, and rolling your own library is too time-consuming. Most devs end up settling for underwhelming sharing options for lack of the time or inclination to make something better.

OvershareKit makes it trivial to add rich sharing options to your iOS apps.

How to know if an application is installed?

Even though you can't discover them. If you know the application you're looking for and what kind of URL Scheme it responds to, then you can check if your app is able to open that kind of URL.

That's what IntentKit is for, it's a repository of knowledge about applications, the URL Schemes they respond to and the kind of actions they can perform. With the introduction of extensions.

For example, you can check if Facebook is installed by checking if you can open a fb:// URL.

BOOL isFacebookInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]];

About IntentKit's inner workings

Internally, IntentKit will check for that same thing, as you can see in INKActivity's implementation:

- (BOOL)canPerformCommand:(NSString *)command {
    if (!self.actions[command]) { return NO; }

    if (self.presenter) {
        return [self.presenter canPerformAction:command];
    } else {
        NSURL *url = [NSURL URLWithString:[self.actions[command] urlScheme]];
        return [self.application canOpenURL:url];
    }
}

Info about requested UIActivity services:

Workarounds

Most of these services are based on known protocols, or slight variations of them. For example, you can use XMPP (aka Jabber) to directly send messages to a Facebook IM or Kik account; some people say that Viber seems to use a modification of SIP for signaling with VoIP phones. So you could work around some SDK/API limitations by using the underlying mechanisms.


SDK or API?

If all you need is to send a message to those services, I'd argue that you don't really need to communicate with the installed application via an SDK or URL Schemes, I haven't been able to test the Big Emoji app you mentioned, as it just crashes on iOS 8, but if it's using the services API's, you could easily work it out by using Charles or Wireshark.

Community
  • 1
  • 1
NiñoScript
  • 4,523
  • 2
  • 27
  • 33
  • thanks for the answer, but it seems possible in ios 7. this app (https://itunes.apple.com/app/id501840899?mt=8) is able to show kakao, line, wechat, and others in the UIActivityViewController. do you know how? – Crashalot Jul 25 '14 at 17:23
  • What you can't do is "discover" them, as stated on your question. What you *can* do is, knowing that application exists and what kind of URL Schema it responds to, check if your app is able to open that kind of URL. I'll edit the answer and add more details. – NiñoScript Jul 25 '14 at 18:24
  • I'm curently downloading the app to check how it works, but for the moment, I'll add some UIActivity implementations for the requested services. – NiñoScript Jul 25 '14 at 19:48
  • Hey @Crashalot , in the end, was the answer ok for you? – NiñoScript Jul 30 '14 at 03:42
  • hi there, still testing and trying to find details for viber and kik. did you find anything there? – Crashalot Jul 30 '14 at 06:55
  • hmmm, doesn't seem to quite work. skype doesn't support images from our testing and fb-messenger requires the user id. there doesn't appear to be a generic url for sharing images with fb-messenger? – Crashalot Jul 30 '14 at 07:22
  • I added some info for Kik; Viber doesn't have an API. You should ask the developers of those apps for more info, or try to reverse engineer Big Emoji, because they had to implement all those UIActivities manually. Or just wait for developers to add extensions to their apps when iOS 8 is released. – NiñoScript Jul 30 '14 at 15:57
  • The Imoji app (https://itunes.apple.com/app/imojiapp/id884963181?mt=8) seems to have figured out sharing to FB Messenger. Any suggestions on how to determine how they got this to work? – Crashalot Aug 26 '14 at 02:29
0

Presumably they are adding a bunch of their own custom actions, as described in this answer.

There is no central repository for third-party sharing support before iOS 8. You can check for the other apps' presence by using URL Schemes. To do this, you'll have to look at each app's documentation and figure out what schemes they accept, then do something like this:

NSArray* items = /* stuff you want to share */
NSMutableArray* activities = NSMutableArray.array;
if ([UIApplication.sharedApplication canOpenUrl:@"whatsapp://url"])
{
   UIActivity* activity = /* create activity for whatsapp */
   [activities addObject:activity];
}    
if ([UIApplication.sharedApplication canOpenUrl:@"facebook://url"])
{
   UIActivity* activity = /* create activity for facebook */
   [activities addObject:activity];
}
// ... repeat for other services ...
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:activities];

// show the VC however appropriate.
Community
  • 1
  • 1
ahruss
  • 2,070
  • 16
  • 21
0

In addition to @NinoScript, you can find here the URL schemes for the iOS apps (inside the .plist files) which is provided by IntentKit as he mentioned.

Here is a summarized list from the project:

  • 1Password ophttps://{{{url}}}
  • Chrome: googlechromes://{{{url}}}
  • Gmail: googlegmail:///co?to={{recipient}}
  • Google Maps: comgooglemaps://?q={{query}}
  • Google+: gplus://plus.google.com/{{userId}}
  • Safari: http://{{{url}}}

For a full URL-schemes search the git project.

Community
  • 1
  • 1
OhadM
  • 4,687
  • 1
  • 47
  • 57