import org.json.JSONObject;
// Constructing a JSONObject for the mobile number.
JSONObject mobileJson = new JSONObject();
mobileJson.put("isd", "91");
mobileJson.put("number", "9988774455");
// Constructing a JSONObject for the user.
JSONObject userJson = new JSONObject();
userJson.put("email", "[email protected]");
userJson.put("mobile", mobileJson);
// Constructing a JSONObject for the theme.
JSONObject themeJson = new JSONObject();
themeJson.put("mode", "dark");
themeJson.put("seed", "#2962FF");
// Constructing the root JSONObject which will contain the user and theme details.
JSONObject optionsJson = new JSONObject();
optionsJson.put("intent", "connect");
optionsJson.put("module", "com.quicko.it.file");
optionsJson.put("user", userJson);
optionsJson.put("theme", themeJson);
// Triggering the FILE module with the constructed JSON options.
// The open() method in QuickoSDK is a suspend function.
// Suspend functions in Kotlin require an additional Continuation parameter when called from Java.
// Java does not natively support coroutines, so you must explicitly provide a Continuation instance.
// Below is an example of invoking the open() method with a "dummy" Continuation to handle or ignore the result.
QuickoSDK.INSTANCE.open(
getApplicationContext(), // Pass the application context as the first parameter
optionsJson, // Provide the JSONObject with options as the second parameter
new Continuation<Unit>() { // Manually implement the Continuation interface for the third parameter
@NotNull
@Override
public CoroutineContext getContext() {
// Returning an empty coroutine context as no specific context is required here.
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NotNull Object result) {
// This method is called when the suspend function completes.
// The 'result' parameter can contain either the success result or an exception:
// - If successful, result will be of type Unit.
// - If an exception occurred, result will be an instance of Result.Failure.
// For simplicity, you can leave this method empty since you don't need to handle the outcome.
}
}
);