Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Gmail app from my app

I'm trying to send an email from my app. But what I want is if user is having Gmail app on his/her phone, then mail should be sent using it. If Gmail app is unavailable then the user should be redirected to Mailbox.

So how can I know if user contains Gmail app and how can I redirect user to it.

like image 504
Ankita Shah Avatar asked Aug 20 '15 09:08

Ankita Shah


People also ask

How do I get my Gmail on my app?

From the Home screen, tap the Apps icon (in the QuickTap bar) > the Apps tab (if necessary) > Google folder > Gmail or tap Google folder > Gmail on the Home screen.

Why my Gmail is not opening in app?

Clear your browser cache To test this, try to clear your browser's cache and cookies. Here's how to clear your cache and cookies in Chrome, for example, and if you're using an iPhone, uninstall the Gmail app and then reinstall it from the App Store.

How can I access my Gmail account?

Any web browser—Go to mail.google.com. and choose Gmail. Android devices—Install and open the Android app.

How do I add Gmail to my dock?

Add Gmail to your dock To easily open Gmail, add the app to your dock: Tap and hold the Gmail app . Drag the Gmail app down, and release it on your dock.


1 Answers

Setup for iOS9+

As explained here, if you're on iOS9+, don't forget to add googlegmail to LSApplicationQueriesSchemes on your info.plist

my info.plist

Code to open GMail

Then, you can do the same as the accepted answer (below is my swift 2.3 version):

let googleUrlString = "googlegmail:///co?subject=Hello&body=Hi" if let googleUrl = NSURL(string: googleUrlString) {     // show alert to choose app     if UIApplication.sharedApplication().canOpenURL(googleUrl) {         if #available(iOS 10.0, *) {           UIApplication.sharedApplication().openURL(googleUrl, options: [:], completionHandler: nil)         } else {           UIApplication.sharedApplication().openURL(googleUrl)         }     } } 
like image 194
ghashi Avatar answered Sep 19 '22 09:09

ghashi