Initializing BMSClient
BMSCore provides the HTTP infrastructure that the other IBM Cloud® Web and Mobile services client SDKs use to communicate with their corresponding IBM Cloud services.
Initializing your Android app
You can either download and import the BMSCore package to your Android Studio project, or use Gradle.
-
Import the Client SDK by adding the following
importstatement at the beginning of your project file:import com.ibm.mobilefirstplatform.clientsdk.android.core.api.*; -
Initialize the
BMSClientSDK in your Android application by adding the initialization code in theonCreatemethod of the main activity in your Android app, or in a location that works best for your project.BMSClient.getInstance().initialize(getApplicationContext(), BMSClient.REGION_US_SOUTH); // Make sure that you point to your regionInitialize the
BMSClientwith thebluemixRegionparameter. In the initializer, thebluemixRegionvalue specifies which IBM Cloud deployment you are using, for example,BMSClient.REGION_US_SOUTH,BMSClient.REGION_UK, orBMSClient.REGION_SYDNEY.
Initializing your iOS app
You can use CocoaPods or Carthage to get the BMSCore package.
-
To install
BMSCoreby using CocoaPods, add the following lines to your Podfile. If your project doesn't have a Podfile yet, use thepod initcommand.use_frameworks! target 'MyApp' do pod 'BMSCore' endThen run the
pod installcommand, and open the generated.xcworkspacefile. To update to a newer release ofBMSCore, usepod update BMSCore.For more information about using CocoaPods, see the CocoaPods Guides.
-
To install
BMSCoreby using Carthage, follow these instructions.-
Add the following line to your Cartfile:
github "ibm-bluemix-mobile-services/bms-clientsdk-swift-core" -
Run the
carthage updatecommand. -
After the build is finished, add
BMSCore.frameworkto your project by following Step 3 in the Carthage instructions.For apps that are built with Swift 2.3, use the
carthage update --toolchain com.apple.dt.toolchain.Swift_2_3command. Otherwise, use thecarthage updatecommand.
-
-
Import the
BMSCoremodule.import BMSCore -
Initialize the
BMSClientclass by using the following code.Place the initialization code in the
application(_:didFinishLaunchingWithOptions:)method of your app delegate, or in a location that works best for your project.BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) // Make sure that you point to your regionInitialize the
BMSClientwith the bluemixRegion parameter. In the initializer, the bluemixRegion value specifies which IBM Cloud deployment you're using, for example,BMSClient.Region.usSouth,BMSClient.Region.unitedKingdom, orBMSClient.Region.sydney.
Initializing your Cordova app
-
Add the Cordova plug-in by running the following command from your Cordova app root directory:
cordova plugin add bms-core -
Initialize the
BMSClientclass in your Cordova app by adding the initialization code in the main JavaScript file, or in a location that works best for your project.BMSClient.initialize(BMSClient.REGION_US_SOUTH);Initialize the
BMSClientwith the bluemixRegion parameter. In the initializer, the bluemixRegion value specifies which IBM Cloud deployment you're using, for example,BMSClient.REGION_US_SOUTH,BMSClient.REGION_UK, orBMSClient.REGION_SYDNEY.