Use this library to add Inventiv Critic to your Android app.
- Add the Inventiv repository to your
build.gradle
file.
allprojects {
repositories {
google()
jcenter()
maven { url 'https://repo.inventiv.io/' }
}
}
- Add the following dependency to your
app/build.gradle
file.
dependencies {
implementation 'io.inventiv.critic.android:critic-android:1.0.4'
}
- Find your Product Access Token in the Critic Web Portal by viewing your Product's details.
- Initialize Critic by starting it from the
onCreate()
method of your main Application class.
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Critic.initialize(this, "YOUR_PRODUCT_ACCESS_TOKEN");
}
}
By default, Critic will prompt your users for feedback when they shake their device. You can disable this if desired.
// do this after you call Critic.initialize(this, "YOUR_PRODUCT_ACCESS_TOKEN");
Critic.stopShakeDetection();
Alternatively, you can show the default feedback report screen any time you like by calling the following method.
Critic.showFeedbackReportActivity();
You can add product-specific metadata through the Critic.setProductMetadata(JsonObject)
method.
JsonObject productMetadata = new JsonObject();
productMetadata.addProperty("email", "test@example.com");
Critic.setProductMetadata(productMetadata);
Use the BugReportCreator
to build your own reports for custom user experiences or other use cases. Perform BugReportCreator
work on a background thread.
String description = "Text provided by your user.";
JsonObject metadata = new JsonObject();
metadata.addProperty("star_rating", 5);
metadata.addProperty("user_id", "adbe342-93245-32549324-aefff3490");
List<File> files = new ArrayList<File>();
files.add(new File("/path/to/a/file/to/attach"));
files.add(new File("/path/to/another/file/to/attach"));
BugReport report = new BugReportCreator()
.description(description)
.metadata(metadata)
.attachments(files)
.create(mContext); // mContext is a Context object such as your current Activity.
The BugReportCreator.create()
call will return a BugReport object if successful. Otherwise, a ReportCreationException
will be thrown.
Visit the Critic web portal to view submitted reports. Below is some of the device and app-specific information included with every Android report.
This library is released under the MIT License.