Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Latest commit

 

History

History
97 lines (64 loc) · 2.77 KB

app-prerequisites.md

File metadata and controls

97 lines (64 loc) · 2.77 KB
copyright lastupdated
years
2015, 2017, 2018, 2019
2019-02-19

{:new_window: target="_blank"} {:shortdesc: .shortdesc} {:screen:.screen} {:codeblock:.codeblock}

Prerequisites

{: #prerequisites}

Creating a Mobile Analytics service instance

{: #prerequisites_1}

  1. In the IBM Cloud Catalog, click Mobile > Mobile Analytics.
  2. Provide a Service name.
  3. Click Create.
  4. Choose to connect to other existing apps, or leave it unbound.

You can choose to create either a bound service or an unbound service. Bound services are connected to other IBM Cloud apps, while unbound services are standalone and not connected to other apps.

Initializing your app

{: #prerequisites_app}

Import and install the {{site.data.keyword.mobileanalytics_short}} Client SDKs. You can optionally use the {{site.data.keyword.mobileanalytics_short}} REST API External link icon{:new_window}.

###Import the Client SDKs

Import the Client SDKs and initialize them with the following code snippet to record usage analytics:

  • Android

    Add the following import statements to the beginning of your project file:

     	import com.ibm.mobilefirstplatform.clientsdk.android.core.api.*;
     	import com.ibm.mobilefirstplatform.clientsdk.android.analytics.api.*;
     	import com.ibm.mobilefirstplatform.clientsdk.android.logger.api.*;
    

    {: codeblock}

  • iOS

    The Swift SDK is available for iOS and watchOS.

    Import the BMSCore and BMSAnalytics frameworks by adding the following import statements to the beginning of your AppDelegate.swift project file:

     	import BMSCore
     	import BMSAnalytics

    {: codeblock}

  • Cordova

    Add the Cordova plugin by running the following command from your Cordova application root directory:

     	cordova plugin add bms-core

    {: codeblock}

  • Web

    Add the web plugin by either adding this script in the index.html file of web app:

     	<script src="bms-clientsdk-web-analytics/bmsanalytics.js"></script>

    {: codeblock}

    Or by using module loader requirejs. The name used as reference API is same as the argument name (BMSAnalytics) used.

     	require.config({
        'paths': {
            'bmsanalytics': 'bms-clientsdk-web-analytics/bmsanalytics'
        	}
    	});
    		require(['bmsanalytics'], function(BMSAnalytics) {
    	    BMSAnalytics.send();
    	}

    {: codeblock}

Your next step is to Instrument your app .