This document describes systematic guidelines in integrating OnMobile RBT SDK framework.This document provides complete guidelines to integrate OnMobile RBT Framework in iOS project.
OnMobile SDK can be integrated to any iOS project through CocoaPods. You can refer Cocoapods for more details.
Command to install CocoaPods (If it is not installed on your OS X)
$ sudo gem install cocoapods
To integrate OnMobile RBT SDK into your Xcode project using CocoaPods(Use the version number provided to you), specify it in your Podfile
:
pod 'OnMobileRBTSDK/<module_extension_name_shared_by_organization>', 'x.x.x'
Then, run the following command on your project path:
$ pod install
or
$ pod install --repo-update
If, you see the below error :
[!] CocoaPods could not find compatible versions for pod "OnMobileRBTSDK":
In Podfile:
OnMobileRBTSDK (<x.x.x>)
None of your spec sources contain a spec satisfying the dependency: `OnMobileRBTSDK (<x.x.x>)`.
Please, do run the below commands:
$ pod repo update
$ pod install
OnMobile SDK can be integrated to any iOS project through Swift Package Manger. You can refer Swift Package Manger for more details.
Once you have your Swift package set up, adding OnMobileRBTSDK as a dependency is as easy as adding it to the dependencies value of your Package.swift.
dependencies: [
.package(url: "https://github.com/ONMO/OnMobileRBT.git", exact: "x.x.x"),
]
Post installing OnMobile RBT SDK to your project, please update the project settings by following below steps
App Transport Security Settings
- Dictionary
- Add below item a1Allow Arbitrary Loads
- Boolean
- Yes
Privacy - Contacts Usage Description
- String
- Your preffered message to alert user about accessing contacts in app on the supported localizationPrivacy - Microphone Usage Description
- String
- Your preffered message to alert user about accessing microphone in app on the supported localizationPrivacy - Speech Recognition Usage Description
- String
- Your preffered message to alert user about determing the voice of microphone in app on the supported localizationimport OnMobileRBTSDK_<module_extension_name_shared_by_organization>
Initializes `OnMobileRBTSDK`
@objc static func initialize(
withAuthenticationKey authKey: String,
andClientKey clientKey: String,
succedded success: @escaping (() -> ()),
failed fail: @escaping ((OnMobileRBTError) -> ())
)
- authKey : Provide the OnMobileRBTSDK authentication key shared by organization to intialize
- clientKey : Provide the Client key shared by organization to intialize
- success : Povides a successfull callback after initializtion
- fail : Provides the error callback with OnMobileRBTError object to handle the errors
OnMobileRBTConnector.initialize(
withAuthenticationKey: "<Authentication Key>",
andClientKey: "<Client Key>",
succedded: {
/*Success call back code*/
},
failed: { (error) in
/*Failure call back code*/
}
)
Checks whether the content is available or not for the provided ISRC codes
@objc static func contentAvailability(
for isrcs: [String],
succedded success: @escaping (([IsrcItem]) -> ()),
failed fail: @escaping ((OnMobileRBTError) -> ())
)
- isrcs : Provide the list of ISRC codes to check the availability
- success : Provides the successfull callback with list of IsrcItem object
- fail : Provides the error callback with OnMobileRBTError object to handle the errors
OnMobileRBTConnector.contentAvailability(
for: ["<isrcid1>", "<isrcid2>"],
succedded: { (isrcItems) in
/*Success call back code*/
},
failed: { (error) in
/*Failure call back code*/
}
)
Fetches and provides the requested type of content
- For Music Content it is mandatory to provide the id information in request
- For Name Content it is mandatoru to provide the name as id in request
@objc public static func content(for type: ContentType,
with id: String? = nil,
fromOffset offset: Int = 0,
withMaxResult max: Int = 16,
succedded success: @escaping (([OnMobileRBTConnectorContent]) -> ()),
failed fail: @escaping ((OnMobileRBTError) -> ()))
- type: Provide appropriate `ContentType` for which the content data is required
- id: Provide the `ID` for music `ContentType` or `Name` for name `ContentType` for other type it can be null
- offset: Provide the offset value from which the content is required if there is pagination
- max: Provide the max value for which the content length required for each request
- success: Provides the successfull callback with array of`OnMobileRBTConnectorContent` objects
- fail: Provides the error callback with `OnMobileRBTError` object to handle the errors
OnMobileRBTConnector.content( for: contentType, with: multipleIsrcsTextField.text, fromOffset: 0, withMaxResult: 8) { (response) in /Success call back code/ } failed: { (error) in /Failure call back code/ }
OnMobileRBTMSISDNDetail
object to pass in the OnMobileRBTClientDetail
ObjectDeclaration
@objc public static func create(msisdn: String,
customerId: String? = "") -> OnMobileRBTMSISDNDetail
Parameters
- msisdn: Provide appropriate msisdn
- customerId: Provide appropriate customerId if any
Implementation
let onMobileRBTMSISDNDetail = OnMobileRBTMSISDNDetail.create(msisdn:<phonenumber>, customerId: <customer id if any>")
OnMobileRBTClientDetail
object to pass in the setup
methodDeclaration
@objc public static func create(msisdn: OnMobileRBTMSISDNDetail,
otherMsisdns msisdns: [OnMobileRBTMSISDNDetail] = [],
languageCode language: String? = nil,
accountCode account: String? = nil,
customerType customer: String? = nil,
segment: String? = nil,
type: ClientType = .normal) -> OnMobileRBTClientDetail
Parameters
- msisdn: Provide appropriate `OnMobileRBTMSISDNDetail` object to setup user to use the `OnMobileRBTSDK` with the msisdn & customerId if any
- msisdns: Provide array of numbers along with customerId's if any to support multiple numbers in `OnMobileRBTSDK` (check with organization wheter it supports not)
- language: Provide the language code to dispay the content in appropriate language (Take the code from organization)
- account: Provide the account code if any
- customer: Provide the customer type if any
- segment: Provide the segment if any
- type: Provide the client type if any
Implementation
let onMobileRBTClientDetail = OnMobileRBTClientDetail.create(
msisdn: <`OnMobileRBTMSISDNDetail` object>,
otherMsisdns: <Array of `OnMobileRBTMSISDNDetail` objects>,
languageCode: languageCode,
accountCode: accountCode,
customerType: customerType,
segment: segment,
type: type)
Setup the user to forward with the transactions.
@objc public static func setup(
withOnMobileRBTClientDetail client: OnMobileRBTClientDetail,
controller: UIViewController,
listener selector: Selector? = nil,
eventListener eventSelector: Selector? = nil,
playerListener playerSelector: Selector? = nil,
succedded success: @escaping ((OnMobileRBTConnectorResponse) -> ()),
failed fail: @escaping ((OnMobileRBTError) -> ()))
- client: Provide appropriate `OnMobileRBTMSISDNDetail` object to setup user to use the `OnMobileRBTSDK` with the msisdn & customerId if any
- controller: Provide the controller, on which the `OnMobileRBTSDK` listeners needs to be handled
- selector: Provide the selector to handle the listeners
- eventSelector: Provide the selector to handle the event listeners
- playerSelector:Provide the selector to handle the player listeners
- success: Provides the successfull callback with `OnMobileRBTConnectorResponse` object to use for further transactions
- fail: Provides the error callback with `OnMobileRBTError` object to handle the errors
OnMobileRBTConnector.setup(
withOnMobileRBTClientDetail: <onMobileRBTClientDetail of type `OnMobileRBTClientDetail`>,
controller: self,
listener: nil,
eventListener: nil,
playerListener: nil,
succedded: { (response) in
/*
Success call back code
self.onMobileRBTConnectorResponse = response
*/
},
failed: { (error) in
/*Failure call back code*/
}
)
Save the response object `OnMobileRBTConnectorResponse` for further transactions,
please call the below methods on this object
Launches the OnMobileRBTSDK (optionally you can provide the deeplink url to launch particular UI)
(Use the saved instance object `OnMobileRBTConnectorResponse` to call this method)
@objc func launch(
with url: String? = nil,
on controller: UIViewController,
animated: Bool,
failed fail: @escaping ((OnMobileRBTError) -> ()))
- url: Provide the deeplink url, so the sdk will directly launch on to that particular content view
- controller: Provide the controller, on which the `OnMobileRBTSDK` app to be launched
- animated: `true / false`
- fail: Provides the error callback `OnMobileRBTError` object to handle the errors
self.onMobileRBTConnectorResponse?.launch(
with: <deeplink url>,
on: self,
animated: true,
failed: { (error) in
/*Failure call back code*/
})
Launches the OnMobileRBTSDK Preview UI for the provided ISRC code to set it as RBT
(Use the saved instance object `OnMobileRBTConnectorResponse` to call this method)
@objc func previewAndSetRBT(
for isrc: String,
on controller: UIViewController,
animated: Bool,
failed fail: @escaping ((OnMobileRBTError) -> ())
)
- isrc : Provde theISRC code to preview and set
- controller : Provide the controller, on which the OnMobileRBTSDK preview UI to be shown
- animated : true / false
- fail : Provides the error callback OnMobileRBTError object to handle the errors
self.onMobileRBTConnectorResponse?.previewAndSetRBT(
for: "<isrcid>",
on: self,
animated: true,
failed: { (error) in
/*Failure call back code*/
})
Provides the response object with the required parameters
- Provides the RBT track title name
public var title : String?
- Provides the RBT track album name
public var album : String?
- Provides the RBT track artist name
public var artist : String?
- Provides the RBT identifier
public var contentID : String?
- Provides the RBT content language
public var contentLanguage : String?
- Provides the RBT content type
public var contentType : ContentType?
- Provides the RBT track artwork image URL
public var imageURL : String?
- Provides the RBT track preview URL
public var previewStreamURL : String?
- Provides the RBT track downloads count
public var displayDownloadCount : String?
- Provides the RBT track name
public var name : String?
Provides all the content types available
- music
- trending
- name
- profile
3.1.1