Manual Startup Instructions
Initialising the modules manually.
The SDK uses Android App Startup to automatically initialize and start the SDK. If you have disabled App Startup for your application, please follow the below steps. The SDK must be started before attempting to use any of its features. Startup must occur from your Application.onCreate
method, if your app does not have an Application class you must create one.
// Application class to initialize the WebexConnect SDK
class MyDemoApplication: Application() {
override fun onCreate() {
super.onCreate()
// Set the application context
WebexConnect.applicationContext = this
// Get the instance of WebexConnect
val webexConnect: WebexConnect = WebexConnect.instance
// Initialize the WebexConnect SDK
webexConnect.startup { exception ->
if (exception == null) {
Log.d("DemoApplication", "WebexConnect SDK started successfully")
} else {
Log.e("DemoApplication", "WebexConnect SDK failed to start", exception)
}
}
// Register additional modules. Register only those you plan to use.
// Get the PushMessaging instance
val pushMessaging: PushMessaging = PushMessaging.instance
// Create the PushProvider instance (If using FCM)
val pushProvider = FcmPushProvider.create(this)
// Create the PushProvider instance (If using HMS)
// HmsPushProvider pushProvider = HmsPushProvider.create(this);
// Assign the provider.
pushMessaging.provider = pushProvider
// Register the PushMessaging module with WebexConnect
webexConnect.registerModule(pushMessaging)
// Get the InAppMessaging instance
val inAppMessaging: InAppMessaging = InAppMessaging.instance
// Register the InAppMessaging module with WebexConnect
webexConnect.registerModule(inAppMessaging)
}
}
// Application class to initialize the WebexConnect SDK
public class MyDemoApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Set the application context
WebexConnect.setApplicationContext(this);
// Get the instance of WebexConnect
WebexConnect webexConnect = WebexConnect.getInstance();
// Initialize the WebexConnect SDK
webexConnect.startup(exception - > {
if (exception == null) {
Log.d("DemoApplication", "WebexConnect SDK started successfully");
} else {
Log.e("DemoApplication", "WebexConnect SDK failed to start", exception);
}
return null;
});
// Register additional modules. Register only those you plan to use.
// Get the PushMessaging instance
PushMessaging pushMessaging = PushMessaging.getInstance();
// Create the PushProvider instance (If using FCM)
FcmPushProvider pushProvider = FcmPushProvider.create(this);
// Create the PushProvider instance (If using HMS)
// HmsPushProvider pushProvider = HmsPushProvider.create(this);
// Assign the provider.
pushMessaging.setProvider(pushProvider);
// Register the PushMessaging module with WebexConnect
webexConnect.registerModule(pushMessaging);
// Get the InAppMessaging instance.
InAppMessaging inAppMessaging = InAppMessaging.getInstance();
// Register the InAppMessaging module with WebexConnect.
webexConnect.registerModule(inAppMessaging);
}
}
Updated 8 days ago