instabug_flutter 0.0.3-alpha.1
instabug_flutter: ^0.0.3-alpha.1 copied to clipboard
Instabug is an in-app feedback and bug reporting tool for mobile apps. With just a simple shake, your users or beta testers can report bugs or send in-app feedback and the SDK will capture an enviro [...]
Instabug for Flutter #
A Flutter plugin for Instabug.
⚠️ This plugin is currently under active development and is not ready for production use yet. If you'd like to give us feedback or create a pull request, we would highly appreciate it!
Available Features #
| Feature | Status |
|---|---|
| Bug Reporting | ⚙️ |
| Crash Reporting | ❌ |
| In-App Chat | ❌ |
| In-App Surveys | ⚙️ |
| Feature Requests | ❌ |
- ✅ Stable
- ⚙️ Under active development
- ❌ Not available yet
APIs #
The section below contains the APIs we're planning to implement for our 1.0 release across different classes. We'll add the Dart API methods as we implement them.
Instabug
| API Method | Native Equivalent (Android/iOS) |
|---|---|
start(String token, List<InvocationEvent> invocationEvents) |
new Instabug.Builder(this, "APP_TOKEN").build()+ startWithToken:invocationEvents: |
showWelcomeMessageWithMode(WelcomeMessageMode welcomeMessageMode) |
showWelcomeMessage(WelcomeMessage.State state)+ showWelcomeMessageWithMode: |
identifyUserWithEmail(String email, [String name]) |
identifyUser(String username, String email)+ identifyUserWithEmail:name: |
logOut() |
logoutUser()+ logOut |
setLocale(Locale locale) |
setLocale(Locale locale)+ setLocale: |
setColorTheme(ColorTheme colorTheme) |
setColorTheme(InstabugColorTheme theme)+ setColorTheme: |
appendTags(List<String> tags) |
addTags(String... tags)+ appendTags: |
resetTags() |
resetTags()+ resetTags |
getTags() |
getTags()+ getTags |
setStringForKey(String value, String key) |
setCustomTextPlaceHolders(InstabugCustomTextPlaceHolder placeholder)+ setValue:forStringWithKey: |
setUserAttributeWithKey(String value, String key) |
setUserAttribute(String key, String value)+ setUserAttribute:withKey: |
getUserAttributeForKey(Sring Key) |
getUserAttribute(String key)+ userAttributeForKey: |
removeUserAttributeForKey(String key) |
removeUserAttribute(String key)+ removeUserAttributeForKey: |
getUserAttributes() |
getAllUserAttributes()+ userAttributes: |
logUserEventWithName(String name) |
logUserEvent(String name)+ logUserEventWithName: |
show() |
show()+ show |
setSessionProfilerState(Feature.State state)sessionProfilerEnabled |
|
setPrimaryColor(@ColorInt int primaryColorValue)tintColor |
|
onReportSubmitHandler(Report.OnReportCreatedListener listener)willSendReportHandler. |
|
setUserData(String userData)userData |
|
show()+ show |
|
addFileAttachment(Uri fileUri, String fileNameWithExtension)+ addFileAttachmentWithURL: |
|
addFileAttachment(byte[] data, String fileNameWithExtension) + addFileAttachmentWithData: |
|
clearFileAttachment()+ clearFileAttachments |
|
setWelcomeMessageState(WelcomeMessage.State welcomeMessageState)welcomeMessageMode |
BugReporting
| API Method | Native Equivalent (Android/iOS) |
|---|---|
invokeWithMode(InvocationMode invocationMode, [List<InvocationOption> invocationOptions]) |
invoke(InvocationMode mode, @InvocationOption int... options)+ invokeWithMode:options: |
setState(Feature.State state)enabled |
|
setOnInvokeCallback(OnInvokeCallback onInvokeCallback)willInvokeHandler |
|
setOnDismissCallback(OnSdkDismissCallback onSdkDismissedCallback)didDismissHandler |
|
setInvocationEvents(InstabugInvocationEvent... invocationEvents)invocationEvents |
|
setAttachmentTypesEnabled(boolean initial, boolean extra, boolean gallery, boolean recording)enabledAttachmentTypes |
|
setReportTypes(@BugReporting.ReportType int... types)promptOptionsEnabledReportTypes |
|
setExtendedBugReportState(ExtendedBugReport.State state)extendedBugReportMode |
|
setOptions(@Option int... options)bugReportingOptions |
|
show(@BugReporting.ReportType int type)+ showWithReportType:options: |
InstabugLog
| API Method | Native Equivalent (Android/iOS) |
|---|---|
logDebug(String message) |
d(String message)+ logDebug: |
logVerbose(String message) |
v(String message)+ logVerbose: |
logInfo(String message) |
i(String message)+ logInfo: |
logWarn(String message) |
w(String message)+ logWarn: |
logError(String message) |
e(String message)+ logError: |
clearAllLogs(String message) |
clearLogs()+ clearAllLogs: |
Surveys
| API Method | Native Equivalent (Android/iOS) |
|---|---|
setState(Feature.State state)enabled |
|
setAutoShowingEnabled(boolean isAutoShowingEnabled)autoShowingEnabled |
|
getAvailableSurveys()+ availableSurveys |
|
setOnShowCallback(OnShowCallback onShowCallback)willShowSurveyHandler |
|
setOnDismissCallback(OnDismissCallback onDismissCallback)didDismissSurveyHandler |
|
setShouldShowWelcomeScreen(boolean shouldShow)shouldShowWelcomeScreen |
|
showSurveyIfAvailable()+ showSurveyIfAvailable |
|
showSurvey(String token)+ showSurveyWithToken: |
|
setThresholdForReshowingSurveyAfterDismiss(int sessionsCount, int daysCount)+ setThresholdForReshowingSurveyAfterDismiss:daysCount: |
|
hasRespondToSurvey(String token)+ hasRespondedToSurveyWithToken: |
Integration #
Creating a Flutter app on the Instabug dashboard isn't possible yet. Create a React Native app instead.
Installation #
- Add Instabug to your
pubspec.yamlfile.
dependencies:
instabug_flutter:
- Install the package by running the following command.
flutter packages get
Using Instabug #
- To start using Instabug, import it into your Flutter app.
import 'package:instabug_flutter/Instabug.dart';
- Initialize the SDK in
initState(). This line enables the SDK with the default behavior and sets it to be shown when the devices is shaken.
InstabugFlutter.start('APP_TOKEN', [InvocationEvent.shake]);
Make sure to replace app_token with your application token.
- If your app supports Android, create a new Java class that extends
FlutterApplicationand add it to yourAndroidManifest.xml.
<application
android:name=".CustomFlutterApplication"
...
</application>
- In your newly created
CustomFlutterApplicationclass, overrideonCreate()and add the following code.
ArrayList<String> invocationEvents = new ArrayList<>();
invocationEvents.add(InstabugFlutterPlugin.INVOCATION_EVENT_SHAKE);
new InstabugFlutterPlugin().start(CustomFlutterApplication.this, "APP_TOKEN", invocationEvents);
- For iOS apps, Instabug needs access to the microphone and photo library to be able to let users add audio and video attachments. Add the following 2 keys to your app’s
Info.plistfile with text explaining to the user why those permissions are needed:
NSMicrophoneUsageDescriptionNSPhotoLibraryUsageDescription
If your app doesn’t already access the microphone or photo library, we recommend using a usage description like:
- "
<app name>needs access to the microphone to be able to attach voice notes." - "
<app name>needs access to your photo library for you to be able to attach images."
The permission alert for accessing the microphone/photo library will NOT appear unless users attempt to attach a voice note/photo while using Instabug.