TestParktagPods2 0.7.0

TestParktagPods2 0.7.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2016

Maintained by ParktagPod.



  • By
  • ahaseebchina01

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Integration Steps

1. Add SDK files to your project: File -> Add Files to "YourApp.xcodeproject"
        * Find and select the folder that contains the SDK
        * Make sure that Copy items into destination folder (if needed) is checked
        * Set Folders to Create groups for any added folders
        * Select the target that you want to add the SDK to
2. Verify that libParkTAG.a has been added to the Link Binary With Libraries Build Phase for the target you want to use the SDK with
        * Select your Project in the Project Navigator
        * Select the target you want to enable the SDK for
        * Select the Build Phases tab
        * Open the Link Binary With Libraries Phase

If lib files are not listed, drag and drop the them from your Project Navigator to the Link Binary With Libraries phase

Add CoreMotion, CoreLocation, CoreTelephony, AdSupport, AVFoundation, CoreBluetooth, SystemConfiguration and ExternalAccessory frameworks libraries to your Link Binary With Libraries Build Phase

1. Select your Project in the Project Navigator
2. Select the target you want to enable the SDK for
3. Select the Build Phases tab
4. Open the Link Binary With Libraries Phase
5. Click the + to add a new library
6. Find CoreLocation in the list and add it

Repeat Steps 5 and 6 again for CoreTelephony, CoreMotion, AdSupport, AVFoundation, CoreBluetooth, SystemConfiguration and ExternalAccessory Frameworks

Getting Started

You need to enable background location updates for your App in order to receive location updates even when application is in background, All you have to do is add "App registers for location updates" under the "Required background modes" you can either edit plist file in a text editor and add following code or can use Xcode to add required background modes.

Additionally for iOS 8 you need two add two more keys to your info.plist file i.e NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription, these keys will contain text that will be displayed when iOS display Locations services permission's alert.


<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>

Additionally for iOS 8, you need to add one more key to your info.plist file i.e NSLocationAlwaysUsageDescription. This key should contain a text string, which will be displayed when iOS display Locations services permission's alert in your app.

<key>NSLocationAlwaysUsageDescription</key>
<string>Data stays secure on your phone. GPS will help you find parking. Vacancy will be posted anonymously.</string>

Implement SDK

// implement ParktagDelegate in your AppDelegate and instantiate ParkTAG SDK

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Following code sample instantiate ParkTAG SDK and sets delegate method

Parktag *parktag = [Parktag sharedInstance];
parktag.delegate = self;
parktag.apiKey = @"YOUR-API-KEY";
}


/**
* Starts the ParkTag Tracker if delegate and API-Key is set, otherwise returns Error
* @param handler: The argument to the completion handler block is an error object that contains
* the description of the error in case an error is encountered while starting the ParkTAG tracker.
* If the tracker is started successfully, the error object is set to nil.
*/

- (IBAction)startParktag:(id)sender {
[[Parktag sharedInstance] startWithCompletionHandler:^(NSError *error) {
if (error) {
NSLog(@"Error : %@", [error description]);
}
}];
}

// Stop ParkTAG Tracker

- (IBAction)stopParktag:(id)sender {
[[Parktag sharedInstance] stop];
}

// Manually activate GPS for short period of time

-(IBAction)kickStartGPS:(id)sender {
[[Parktag sharedInstance] kickStartGPS];
}

/*
* This method adds a GeoFence of specified radius around the location
* @param identifier: GeoFence identifier
* @param location: Center location of the GeoFence
* @param radius: The distance (measured in meters) from the center geographic region to the edge of the circular boundary.
*/

- (BOOL)addFence:(NSString *)identifier center:(CLLocation *)location radius:(CLLocationDistance)radius {
Parktag *parktag = [Parktag sharedInstance];
return [parktag addFence:identifier center:location radius:radius];
}

/*
* This method returns the status of the tracker i.e. if it is active or otherwise
*
* TrackerStatus
* Discussion: Represents the current tracker state
* TrackerStatusActive : Tracker is in a working, active state
* TrackerStatusLocationServicesDisabled : Tracker is not in a working state as the location services are disabled
* TrackerStatusInsufficientPermission : Tracker is not in a working state as the permissions to use location services are not provided by the user
* TrackerStatusInActive : Tracker has not been started. It is in inactive state
*/

- (TrackerStatus)trackerStatus {
Parktag *parktag = [Parktag sharedInstance];
return [parktag trackerStatus];
}

// An alphanumeric string that uniquely identifies a device to the tracker

- (NSString *)deviceIdentifier {
Parktag *parktag = [Parktag sharedInstance];
return [parktag deviceIdentifier];
}

Delegate Methods

@optional

/*
* This method is invoked when ParkTAG detects that user is about to vacate his parking
* spot and is approaching to his vehicle (this feature is currently in beta state)
* @param location: The Location where ParkTAG identified the parking, which is about to be vacated
*/
- (void)vacatingParking:(CLLocation *)location;

/*
* This method is invoked when ParkTAG detects that user has just vacated
* a parking spot and have started a new trip
* @param location:  The Location where ParkTAG identified start of the trip
* @param startTime: Start time of trip
*/
- (void)vacatedParking:(CLLocation *)location startTime:(NSDate *)startTime;

/*
* This method is invoked when ParkTAG detects that recently vacated vehicle is not a Car
*/
- (void)vacatedParkingCanceled;

/*
* This method is invoked when ParkTAG suspects that user has just parked his vehicle
* Most of the time, it is followed by a confirmed vehicleParked event
* If you need only confirmed parked events, use vehicleParked method (below) instead
* @param location:  The Location where vehicle is parked
* @param startTime: Start time of trip
* @param stopTime:  Stop time of trip
*/
- (void)vehicleParkedSuspected:(CLLocation *)location startTime:(NSDate *)startTime stopTime:(NSDate *)stopTime;

/*
* This method is invoked when ParkTAG detects that user has just parked his vehicle
* @param location:  The Location where vehicle is parked
* @param startTime: Start time of trip
* @param stopTime:  Stop time of trip
*/
- (void)vehicleParked:(CLLocation *)location startTime:(NSDate *)startTime stopTime:(NSDate *)stopTime;

/*
* This method is invoked when ParkTAG user is looking for a free parking
* @param location:  The Location where ParkTAG identified that user is searching for parking
*/
- (void)searchingParking:(CLLocation *)location;

/*
* This is invoked when new location information is received from Location manager
* Implemented this method if you need raw GPS data, instead of creating new location manager
* It is not recommended using multiple location managers in a single app
* @param location:  New location received from GPS
*/
- (void)didUpdateLocation:(CLLocation *)location;

Installation

TestParktagPods2 is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TestParktagPods2"

Author

haseebOptini, [email protected]

License

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