GithubHelp home page GithubHelp logo

chourobin / gpuberview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gpolak/gpuberview

0.0 1.0 0.0 1.18 MB

Summon Uber from your iOS app with 2 lines of code.

License: MIT License

Objective-C 97.96% Ruby 0.16% C 1.49% Shell 0.38%

gpuberview's Introduction

GPUberView

Summon Uber from your iOS app with 2 lines of code.

GPUberView

Quick Start

#import <GPUberViewController.h>

// ...

GPUberViewController *uber = [[GPUberViewController alloc] initWithServerToken:@"your_server_token"];

// optional
uber.startLocation = CLLocationCoordinate2DMake(40.7471787,-73.997494);
uber.endLocation = CLLocationCoordinate2DMake(40.712774,-74.006059);

[uber showInViewController:self];

Demo

  1. Go to the GPUberViewDemo directory.
  2. Open the .xcworkspace (not the .xcodeproj) file.
  3. Run the app in the Simulator or on the device.

Note:

If the phone has the Uber app installed, tapping any of the Uber service buttons will bring it up with the appropriate parameters already set. Otherwise the Uber mobile website will be launched.

Adding GPUberView to Your Project

CocoaPods

platform :ios, '7.1'
pod "GPUberView"

Usage

Register You App With Uber

To use this library you need a valid Server Token from Uber. You can get it here: https://developer.uber.com

Import GPUberView

#import <GPUberViewController.h>

Initialize the GPUberViewController

Pass in your Uber server token for authentication.

GPUberViewController *uber = [[GPUberViewController alloc] initWithServerToken:@"your_server_token"];

(Optional) Specify the Pickup and/or Destination

You can pass-in the desired pickup and dropoff coordinates as CLLocationCoordinate2D structs.

// example: from Boston South Station to Fenway Park
uber.startLocation = CLLocationCoordinate2DMake(40.7471787,-73.997494);
uber.endLocation = CLLocationCoordinate2DMake(40.712774,-74.006059);
  • If you omit startLocation, GPUberView will attempt to determine it based on your user's current location. For iOS 8.0 and higher, this requires you to add the NSLocationWhenInUseUsageDescription key into your application's Info.plist file. The value should be a short string explaining the reason why your app needs location (e.g., "Uber needs to determine your pickup location.").

  • If you omit the endLocation, GPUberView will not be able to calculate the price estimate, but still will be able to show the estimated pickup time.

Note: If you supply both the pickup and dropoff locations, make sure the distance between the two isn't exceedingly large. Most Uber products cannot drive you from San Francisco to New York.

You can also pass in user-readable names of the pickup and dropoff points. These labels will be shown to the user as the pickup and dropoff labels in the Uber app once launched. If not supplied, GPUberView (or the Uber app itself) will attempt to determine these automatically.

uber.startName = @"South Station";
uber.endName = @"Fenway Park";

(Optional) Add Your Client Id

Add your Uber client id to receive Uber credits for new user signups. You can get it here: https://developer.uber.com

uber.clientId = @"your_client_id";

(Optional) Add User Signup Parameters

Adding one or more of these parameters will make the new user sign-up process smoother in case the user does not have the Uber app installed.

uber.firstName = @"John";
uber.lastName = @"Doe";
uber.email = @"[email protected]";
uber.countryCode = @"US";
uber.mobileCountryCode = @"1";
uber.mobilePhone = @"2125554444";
uber.zipcode = @"10001";

Show GPUberView

[uber showInViewController:self];

License

GPUberView is available under the MIT license. See the LICENSE file for more info.

gpuberview's People

Contributors

chourobin avatar gpolak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.