Prerequisites:
-
Create a Redpen Widget for Mobile. Follow the steps of this document if you have not created one already.
-
To configure Redpen Android SDK, you will need the widget ID of the mobile widget. Refer to this document to get the Reden widget ID.
To integrate the Redpen Android SDK into your application, configure your android application as below:
Add Dependency
Note: Make sure you have added or used mavencentral in the repositories.
- Modify your
build.gradle
. Add the package to thedependencies
. The latest version of our SDK can be found on the maven central page of our SDK.
//build.gradle
dependencies {
...
implementation 'ai.redpen:redpen-ai-capture-widget-android:<THE_LATEST_VERSION_OF_REDPEN_SDK>'
...
} - Make sure the data binding is enabled.
//build.gradle
android {
...
dataBinding {
enabled = true
}
...
}
Initialize the Redpen Capture SDK
Add the following code snippet to the onCreate
method of your Application class.
import ai.redpen.capture.sdk.RedpenWidget;
import ai.redpen.capture.sdk.utils.RedpenInvocationEvent;
public class <Your Application Class> extends Application {
@Override
public void onCreate() {
... 8 // Initialize Redpen Widget
RedpenWidget.getInstance()
.initialize(this, "<WIDGET_ID>")
.setRedpenInvocationEvents(RedpenInvocationEvent.DEVICE_SHAKE) // This is optional. Add this line only if you want to let users capture screenshot by shaking their device.
.build();
}
}
Capture screenshots using custom events
If you want to capture screenshots with custom events (e.g. button click), call the RedpenWidget.captureNow()
method as shown in the below example:
// Your activity class
import ai.redpen.capture.sdk.RedpenWidget;
public void onFeedbackClick(View view) {
RedpenWidget.captureNow();
}
Comments
0 comments
Please sign in to leave a comment.