BBaton App SDK
The BBaton App SDK lets Android and iOS apps invoke the anonymous verification flow directly.
Initialize it with the Client credentials and redirect_uri from Preparation, then wire the returned adult_flag into your app logic.
01 Android
Download the SDK archive, add the .aar to your project, then wire up the build config and Activity code.
Download
- Add the downloaded
.aarfile toapp/libs. - Register the local library reference in
app/build.gradle. - Launch the SDK from your Activity, passing
clientId,clientSecret, andredirectUri.
Gradle
AndroidCOPY
dependencies {
implementation files('libs/bbaton-sdk.aar')
}
Java
Android ActivityCOPY
import com.bbaton.android.sdk.BbatonSdk;
public class BbatonLoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent bbatonIntent = new Intent(BbatonLoginActivity.this, BbatonSdk.class);
bbatonIntent.putExtra("clientId", "client_id issued at BBaton signup");
bbatonIntent.putExtra("clientSecret", "client_secret issued at BBaton signup");
bbatonIntent.putExtra("redirectUri", "redirect_uri registered at BBaton signup");
startActivityForResult(bbatonIntent, 1);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == RESULT_OK && data != null) {
String adultFlag = data.getStringExtra("adult_flag");
}
}
}
02 iOS
Add the framework to your project, configure info.plist, then present the BBaton screen from your ViewController.
Download
- Add the framework under
Frameworks and Librariesin Xcode. - Apply the App Transport Security settings to
info.plist. - Instantiate
BbatonViewControllerin your ViewController and receive results via delegate.
Info.plist
iOSCOPY
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Swift
ViewControllerCOPY
import UIKit
import BbatonIOSFramework
class ViewController: UIViewController, BbatonDelegate {
@IBAction func toBbatonLogin(_ sender: Any) {
let storyboard = UIStoryboard(name: "Bbaton", bundle: Bundle(for: BbatonViewController.self))
let vc = storyboard.instantiateViewController(withIdentifier: "BbatonViewController") as! BbatonViewController
vc.clientId = "client_id issued at BBaton signup"
vc.clientSecret = "client_secret issued at BBaton signup"
vc.redirectUrl = "redirect_uri registered at BBaton signup"
vc.delegate = self
present(vc, animated: true, completion: nil)
}
func sendUserData(adult_flag: String?) {
let adultFlag = adult_flag
}
}
03 Values & configuration
The SDK uses the values issued during Preparation as-is. Android and iOS pass the same credentials; post-process the result in your app logic.
Item
Description
Type
Note
01
clientId
Required
Issued after application
02
clientSecret
Required
Keep secret
03
redirectUri
Required
Same as registered
04
adult_flag
Return
Adult status value
Return
The default return is adult_flag. Additional verification items can extend the same delivery structure to fit your policy.