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
import
statement at the beginning of your project file:import com.ibm.mobilefirstplatform.clientsdk.android.core.api.*;
-
Initialize the
BMSClient
SDK in your Android application by adding the initialization code in theonCreate
method 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 region
Initialize the
BMSClient
with thebluemixRegion
parameter. In the initializer, thebluemixRegion
value 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
BMSCore
by using CocoaPods, add the following lines to your Podfile. If your project doesn't have a Podfile yet, use thepod init
command.use_frameworks! target 'MyApp' do pod 'BMSCore' end
Then run the
pod install
command, and open the generated.xcworkspace
file. To update to a newer release ofBMSCore
, usepod update BMSCore
.For more information about using CocoaPods, see the CocoaPods Guides.
-
To install
BMSCore
by using Carthage, follow these instructions.-
Add the following line to your Cartfile:
github "ibm-bluemix-mobile-services/bms-clientsdk-swift-core"
-
Run the
carthage update
command. -
After the build is finished, add
BMSCore.framework
to 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_3
command. Otherwise, use thecarthage update
command.
-
-
Import the
BMSCore
module.import BMSCore
-
Initialize the
BMSClient
class 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 region
Initialize the
BMSClient
with 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
BMSClient
class 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
BMSClient
with 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
.