Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Mopinion Mobile SDK for android

The Mopinion Mobile SDK can be used to collect feedback from Android apps based on events. To use Mopinion mobile feedback forms in your app you can include the SDK as a Library in your Android Studio project.

There is also a Mopinion Mobile SDK for iOS available here.

Release notes for version 0.4.1

Artifact location change

  • Our SDK has changed location as bintray has stopped service from May 2021.
  • Resultingly, in your main project build.gradle file, our SDK no longer needs the lines with maven { ... ... }.
  • Also the implementation path has changed.
  • You will need a github account to generate your personal read access token.
  • The github token and your github username are required to include the SDK in your Android project.
  • This bumps the version from 0.4.0 to 0.4.1 but functionally both version are the same.
  • We've updated our instructions here to reflect this.

New features

  • Migrated to AndroidX (breaking change).
  • Migrated to react-native 0.61.5 (breaking change).
  • Thumbnail and preview of screenshot.
  • Requires github account.


  • New random distribution algorithm for the proactive trigger condition: percentage of users.
  • Autoclose for web forms.
  • Margins for thank-you page.


The Mopinion Mobile SDK Library can be installed by adding it build.gradle file of your project. The SDK is partly built with React Native, it needs the React Native Library to function.

You can see how your mobile forms will look like in your app by downloading our Mopinion Forms preview app in the Google Play Store.

Create a Github personal access token

You'll need this instead of a password. Create a github personal access token if you don't have one yet, using their instructions. You'll need to requestread:packages permissions to access the SDK.

Put your user name and PAT in environment variables:

$ setenv GITHUBPKG_USERNAME yourgithubusername
$ setenv GITHUBPKG_APITOKEN yourgithubpat

Prepare folder structure

If you have a default Android Studio folder structure for your project, then move all your files from the folder containing the app folder into a new folder android:

$ cd your-project
$ mkdir android
$ mv app android/app
$ mv build.gradle settings.gradle android/
$ # etc.


Install Node.js/npm

make a package.json file in the root of your project:

  "name": "YourAppNameHere",
  "version": "0.1.0",
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
    "@react-native-community/async-storage": "^1.12.1",
	"react-native-webview": "^11.4.0"

$ npm install

Your project folder should now at least contain the following:



  • Google Volley, installation is already included in our instructions below.

Android Studio

In the main project android/build.gradle file, add the following:

buildscript {
    ext.kotlin_version = '1.4.31'

plugins {
    id 'maven'

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        maven {
            // Android JSC is installed from npm
        maven {
            url ''
            credentials {
                username = GITHUBPKG_USERNAME
                password = GITHUBPKG_APITOKEN
        maven { url '' }

The urls "$rootDir/../node_modules/*" assumes the node_modules folder is in the folder above the your app folder.


In the build.gradle file of your main component, set the minSdkVersion to 19 and add the React Native and Mopinion SDK Libraries :

project.ext.react = [
    enableHermes: false,  // clean and rebuild if changing

def enableHermes = project.ext.react.get("enableHermes", false);
def jscFlavor = 'org.webkit:android-jsc:+'
android {
	defaultConfig {
		minSdkVersion 19
		ndk {
		        abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
dependencies {
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    implementation ""
    implementation "com.facebook.react:react-native:0.61.5"    
    implementation project(':react-native-webview')
    implementation project(':@react-native-community_async-storage')
    implementation "com.mopinion.mopinionsdk:mopinionsdk:0.4.1"

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor


In the settings.gradle file of your main component, comment out the line and add the required React Native Projects:

include ':app'
// = "My Application"
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':react-native-webview'
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
include ':@react-native-community_async-storage'
project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')

Again, the above assumes the node_modules/ folder is in the folder above your app folder.


The SDK needs to connect to the Mopinion servers so the internet permission should be added to your AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
		<uses-permission android:name="android.permission.INTERNET" />

Implement the SDK

For instance, in your

Mopinion M = new Mopinion(Context context, String key, boolean log);
M.event(String event);
  • The context is the Activity context from which you would like to activate the feedback form, normally this.
  • The key should be replaced with your specific deployment key. This key can be found in your Mopinion account at the Feedback forms section under Deployments.
  • The log flag can be set to true while developing the app to see Logcat messages in Android Studio from the Mopinion SDK library. (The default is false if not given.)
  • The event is a specific event that can be connected to a feedback form action in the Mopinion system.
  • The default _button event triggers the form, but an unlimited number of custom events can also be added.


Mopinion M = new Mopinion(this, "12345abcde");

extra data

From version 0.3.0 it's also possible to send extra data from the app to your form. This can be done by adding a key and a value to the data() method. The data should be added before the event() method is called if you want to include the data in the form that comes up for that event. key, String value);


import com.mopinion.mopinionsdk.*;
Mopinion M = new Mopinion(this, "12345abcde");
..."first name", "Andy");"last name", "Rubin");

clear extra data

From version 0.3.3 it's possible to remove all or a single key-value pair from the extra data previously supplied with the data(key,value) method. To remove a single key-value pair use this method:

M.removeData(String key)


M.removeData("first name")

To remove all supplied extra data use this method without arguments:




Edit triggers

In the Mopinion system you can define events and triggers that will work with the SDK events you created in your app. Login to your Mopinion account and go to the form builder to use this functionality.

The custom defined events can be used in combination with rules:

  • trigger: passive or proactive. A passive form always shows when the event is triggered. A proactive form only shows once, you can set the refresh time after which the form should show again.
  • percentage (proactive trigger): % of users that should see the form
  • date: only show the form at, after or before a specific date or date range
  • time: only show the form at, after or before a specific time or time range
  • target: the OS the form should show (iOS or Android)


Mopinion Mobile SDK for android