Creating a minimal app with the plug-in

Step-by-step Guide

1. Run the following command to create an app in Cordova

cordova plugin add bluedot-plugin

The first argument is the directory name for your app development environment (created within your current directory). This should not already exist.
The second argument is an optional identifier for your app
The third argument is the optionally displayed name of your app
NOTE: Although the second and third arguments are optional, they are difficult to change later as they are utilised throughout the XML configuration files and generated class names.

2. Update some defaults in the top-level config.xml file:

  1. <description>
  2. <author>
  3. NOTE: <content> is overwritten by the platform specific config.xml.
  4. NOTE: <plugin> is not updated in the top-level config.xml with Point SDK plug-in.  This is added to the platform specific config.xml files as a <feature> automatically by the later steps.

3. Add action buttons for session authentication to the main index.html file.

<h1>Bluedot Plugin Location Demo</h1>
<div class="formLayout">
 <div class="formButtons">
 <input type="button" id="authenticateButton" value="Authenticate" />
 <input type="button" id="logOutButton" value="Log Out" />
<div class="statusArea">
 <textarea rows="12" cols="45" id="statusText" readonly ></textarea>

4. Copy the Bluedot Javascript wrapper functions stored within the plug-in repository in the bdFunctions.js file (to ensure default Cordova security aspects are fulfilled) to your app’s Javascript source folder.
These functions are for your use and adaptation.

5. Import the Bluedot Javascript bdFunctions.js in your app’s index.html:

<script type="text/javascript" src="js/bdFunctions.js"></script

6. Run the following command to add the local Bluedot SDK plug-in:

cordova plugin add

7. Run the following command to add iOS and Android to the app:

cordova platform add ios 
cordova platform add android

8. Build the app; referring to the additional instructions below for iOS and Android builds:

cordova build 

9. Run the emulator from the command line in a specific iOS simulator:

cordova emulate ios --target="iPhone-5s"

10. For Android emulator:

cordova emulate android

11. To run the app on a physical iOS device:

cordova run --device ios

12. To run the app on a physical Android device:

cordova run --device android

iOS Updates

There are some differences between a default Xcode project and the project requirements for an app running Point SDK.  In summary:

  • Point SDK does not enforce Bitcode.
  • The minimum supported version of iOS for Cordova is 6.0 but Point SDK supports 8.0 and above.
  • There are required UIApplicationDelegate methods that are not implemented in the default Cordova AppDelegate that are required by Point SDK.

Updating the Xcode Project

In the Xcode Project

  • Use of Bitcode must be set to NO in Build Settings.
  • Minimum supported iOS version should be set to 8.0 in General.

In the AppDelegate.m file

  • If AppDelegate implement the CLLocationManagerDelegate, you must set BDLocationManager.instance.delegate = self, and the following methods must be added to AppDelegate should they not already be there:
- (void)applicationWillEnterForeground:(UIApplication *)application
    // This method implementation must be present in AppDelegate
- (void)applicationDidEnterBackground:(UIApplication *)application
    // This method implementation must be present in AppDelegate
- (void)applicationWillResignActive:(UIApplication *)application
    // For iOS 10 and above, this method implementation must be present in AppDelegate

Android Updates

Ensure that the device being used to run a test build has the following settings enabled:

  • Developer Mode
  • USB Debugging
Created by Bluedot DevOps on January 16, 2018