Integrating RevTwo in your Android App

  1. Download revtwolib.zip

  2. Add revtwo.gradle (from revtwolib.zip) under the app folder inside you Android project.

  3. Add revtwolib.aar (from revtwolib.zip) under the app/libs folder.

  4. Add the following code under the project level build.gradle:

    allprojects {
        repositories {
            jcenter()
            flatDir{
                dirs 'libs'
            }
        }
    }
  5. Include the following code in app build.gradle:

    apply plugin: 'com.android.application'
    buildscript {
        repositories {
            jcenter()
            flatDir{
                dirs 'libs'
            }
        }
        dependencies {
            classpath 'com.jakewharton:butterknife-gradle-plugin:8.2.0'
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        }
    }
    apply from : "revtwo.gradle"
  6. Include RevTwo library inside dependencies block in app build.gradle:

    compile(name:'revtwolib', ext:'aar')
  7. Add the following code to onCreate method in your application or first activity class (the actual initialize parameters come from the App Model you created in the support portal):

    import com.revtwo.revtwolib.RevTwo;
    import com.revtwo.revtwolibmodels.callback.Callback;
    import com.revtwo.revtwolibmodels.enumerations.ModeEnum;
    ...
    RevTwo.initialize(“ADD YOUR KEY HERE", “ADD YOUR PRIVATE KEY HERE", ModeEnum.R2MODE_DEVELOPMENT, this, new Callback<Void>() {
       @Override
       public void onSuccess(Void param) {
          super.onSuccess(param);
          // Your code here
       }
       @Override
       public void onError(Throwable t) {
          super.onError(t);
          // Error handling
       }
    });
  8. Add the following call to every onCreate method for which you want to enable the Screen Share:

    RevTwo.registerActivityForScreenshare(this);

    When the RevTwo library is doing screen share during a support call session, it needs access to the current view, so when a new activity is created, you need to register it with the library. If there is an activity that you don’t want to be shared, you can choose not to call this function.

You may download and reference RevTwo Sample App to see where code goes withing the project.