Connect your app to the Moovit app using specific action.
For example, “Get Directions” allows your users to see the best transit routes to a specific destination, while “Show Nearby Lines & Stations” they will see all transit options around them “Show Nearby Lines & Stations”.
To use deeplinks on iOS, first check if the Moovit app is installed on the phone. If it’s installed, use the scheme for deeplinking, and if not, send the user to Moovit’s listing on the App Store. The required schemes and links are as follows:
Enabling moovit:// Scheme Links in Your App (REQUIRED on iOS 9+)
You’ll need to whitelist Moovit in your app’s Info.plist file with an LSApplicationQueriesSchemesentry similar that below. This will authorize calls to canOpenURL to check for deeplinks with moovit:// scheme.
<key>LSApplicationQueriesSchemes</key>
<array>
Checking if the Moovit app exists and launching the app / external link
To determine if the app exists, and then launch scheme or external link accordingly, use the call below. Underlined are the links to be used refer to Schemes & Links section for inserting the desired functionality and correct links. In this example, Moovit is opened with the “Nearby Lines & Stations” scheme.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"moovit://"]]) {
// Moovit installed - launch app (with parameters)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
@“moovit://nearby?lat=&lon=&partner_id=” ]];
}
else {
// Moovit not installed - send to store
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
@“https://app.appsflyer.com/id498477945?pid=DL&c=” ]];
}
*Note that you need to replace the scheme and download links with the actual links provided in the deeplinking documents
For using deeplinks on Android, first check if the Moovit app is installed on the phone. If it’s installed use the scheme for deeplinking, and if not send the user to Moovit’s page on the Google Play store. Schemes and links that are required can be found at the bottom of the page.
Checking if Moovit exists & launching Moovit / Download link
To determine if the app exists, and then launch scheme or external link accordingly, use the call below. Underlined are the links to be used refer to the deeplinking documents section for inserting the desired functionality and correct links. In this example, Moovit is opened with the “Nearby Lines & Stations” scheme.
try {
// Assume that Moovit app exists. If not, exception will occur
PackageManager pm = context.getPackageManager();
pm.getPackageInfo("com.tranzmate", PackageManager.GET_ACTIVITIES);
String uri =
// Launch app call - scheme (with parameters)
"moovit://nearby?lat=&lon=&partner_id= ";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(uri));
startActivity(intent);
} catch (PackageManager.NameNotFoundException e) {
// Moovit not installed - send to store
String url = "http://app.appsflyer.com/com.tranzmate?pid=DL&c=";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
To launch Moovit use one of the schemes below and associate the required parameters. Each scheme represents a different action that will be done automatically once the user is in the app.
Using schemes parameters
Passing parameters enables a smoother experience for your users. For example, destination parameters can automatically pass the location information and allow Moovit to instantly show how to reach that destination.
Example link
moovit://nearby?lat=32.075026&lon=34.775625&partner_id=<YOUR_APP_NAME>
By launching Moovit via the “Show nearby lines & stations” scheme, users will land on the map screen, with a specific location pinpointed, and easily be able to see the nearby lines and stations. If location coordinates are not specified, the map will locate at he user’s location.
Scheme structure
moovit://nearby?lat=&lon=&partner_id=<YOUR_APP_NAME>
Parameters
Name | Type | Description |
---|---|---|
lat= | float | Latitude. if not provided – will open on users location |
lon= | float | Longitude. if not provided – will open on users location |
partner_id= | string | Your app’s name (for tracking purposes) |
Example
moovit://nearby?lat=40.758896&lon=-73.985130&partner_id=<YOUR_APP_NAME>
By launching Moovit via the “Get Directions” scheme, users will already have a trip planned for them within the Moovit app. A trip is a set of suggested routes from one origin to one destination.
Scheme structure
moovit://directions?dest_lat=&dest_lon=&dest_name=&orig_lat=&orig_lon=&orig_name=&date=&partner_id=<YOUR_APP_NAME>
Parameters
Name | Type | Description |
---|---|---|
orig_lat= | float | Latitude of the origin. if not provided – will open on users location |
orig_lon= | float | Longitude of the origin. if not provided – will open on users location |
orig_name= | string | Name of the origin (label). if not provided – will show lat/lon as name |
dest_lat= | float | Latitude of the destination. if not provided – will open on users location |
dest_lon= | float | Longitude of the destination. if not provided – will open on users location |
dest_name= | string | Name of the destination (label). if not provided – will show lat/lon as name |
auto_run= | boolean | If false the user will see a preview of the route, and will need to tap “Search” |
partner_id= | string | Your app’s name (for tracking purposes) |
date | date | ISO 8601 (yyyy-MM-ddTHH:mm:ssZ) |
Example
moovit://directions?dest_lat=40.758896&dest_lon=-73.985130&dest_name=Times%20Square&orig_lat=40.735845&orig_lon=-73.990512&orig_name=Union%20Square&auto_run=true&date=2019-04-01T18:30:00+02:00&partner_id=<YOUR_APP_NAME>
If Moovit does not exist on the user’s phone, use the link below in order to send the user to download Moovit. This automatically redirects them to the App Store / Google Play.
Replace <YOUR_APP_NAME> with a unique identifier
https://moovit.onelink.me/3986059930?pid=Developers&c=YOUR_APP_NAME
Contact us, and we’ll provide links according to your needs.
When integrating Moovit into your app, use the assets and texts as presented below based on your specific needs.
Add one of the following labels next to the menu item