Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a URL handler for Gmail for iOS to compose a message?

My iOS application includes sending emails as part of its functionality. MFMailComposeViewController allows in-app composition of an email, with the OS using Mail.app in the background to send the message. However, I want to allow users to send an email with the Gmail app for iOS if they so choose.

Since remote view controllers aren't public API, the only way this would be possible is with a URL handler, but I couldn't find one documented online anywhere. Does anyone know of one? If there is one, is it publicly acknowledged by the Gmail team (i.e. do they consider it public API, or are they using it only between Chrome and Gmail and aren't quite ready to take the wrapping paper off)?

like image 580
cbowns Avatar asked Oct 09 '13 20:10

cbowns


1 Answers

Silly me, I didn't finish doing my research. Once I opened up the Gmail app's .ipa and found googlegmail as a listed CFBundleURLTypes in the Info.plist, the web turned up a few great resources for this:

  1. Finding the Gmail URL scheme for iOS
  2. Finding the Gmail URL scheme for iOS: Part 2
  3. handleOpenURL: Shared Interapp Communication! has a searchable list of URL handlers.

Long story short, this worked on my iPhone 5 running iOS 7.0 and Gmail for iOS v2.4.1, and opened a compose pane in the Gmail app, even when the app had been explicitly killed:

googlegmail:///co?subject=Hello&body=Hi

I'm still looking for confirmation that this is considered a public API of Gmail. Does anyone have any knowledge about how the Gmail team feels about this?

like image 121
cbowns Avatar answered Oct 13 '22 03:10

cbowns