Xamarin.Android Plugin Migration Guide

This guide is intended for developers who have been using the Alchemer Mobile (Apptentive) Xamarin Android Plugin and are migrating to 6.0.0. For comprehensive documentation on the Xamarin Android Plugin, click here.

Prerequesites

Please make sure you have added the following NuGet packages:

Update the Alchemer Mobile (formerly Apptentive) Dependencies

Firstly, remove the existing Apptentive.Android nuget package. Then install the following Apptentive Nuget package:

  • Apptentive.Android

Updating Subproject (If Applicable)

To update the Alchemer Mobile (Apptentive) dependency as a subproject, start by removing the old Apptentive subproject, and then clone or download the code from https://github.com/apptentive/apptentive-xamarin-android, and add all of the modules to your project.

Update Using Statements

Replace using ApptentiveSDK.Android with using ApptentiveSDK.

Update Method Calls

For all method calls which are invoked, instead of calling methods only with Apptentive, access them like this for example:

ApptentiveSDK.Apptentive.Engage();

Implementing ApptentiveActivityInfo

Wherever Notes or Love Dialog are engaged, be sure to implement the Activity as IApptentiveActivityInfo and register the activity to the SDK. Refer to the integration docs for details.

Please set android:enableOnBackInvokedCallback="false" if needed. This allows the confirmation dialog to be shown when the user exits the survey when the back button is pressed.

Register

The register method needs to be updated since it no longer takes a context, but now requires a ApptentiveConfiguration object:

var configuration = new ApptentiveConfiguration("Your Apptentive Key", "Your Apptentive Signature");
ApptentiveSDK.Apptentive.Register(this,configuration);

Log Level

In order to set the log level, it will be done on the ApptentiveConfiguration object before being passed to the register method. However, you must add another Using statement to access the log level. Like so:

using ApptentiveLogLevel = Apptentive.Com.Android.Util.LogLevel;

var configuration = new ApptentiveConfiguration("Your Apptentive Key", "Your Apptentive Signature");
configuration.LogLevel = ApptentiveLogLevel.Verbose;

Engage

Engage method calls no longer require the current context. Refer to the integration docs for a full explanation on how to implement this method.

//Legacy
Apptentive.Engage(this, "event");

//New 
ApptentiveSDK.Apptentive.Engage("event");

Showing Message Center

When showing Message Center you do not need to add a Activity context as an argument.

//Legacy 
Apptentive.ShowMessageCenter(this);

//New 
 ApptentiveSDK.Apptentive.ShowMessageCenter();

Custom Data

When adding custom data with bool, int, double, or long be sure to use the Java.Lang cast. Example:

//Example int
ApptentiveSDK.Apptentive.AddCustomDeviceData(deviceIntKey.Text, (Java.Lang.Number)intValue);

//Example bool
 ApptentiveSDK.Apptentive.AddCustomPersonData(personBoolKey.Text, (Java.Lang.Boolean)personBoolValue);

Proguard Rules

Be sure to add the following ProGuard rules:

# WORKING PROGUARD RULES:
-keep class apptentive.com.android.feedback.survey.model.* { *; }
-keep class com.google.android.play.core.review.** { *; }
-keep class com.apptentive.android.sdk.** { *; }
-keep class apptentive.com.android.feedback.model.** { *; }
-keep class apptentive.com.android.feedback.engagement.interactions.InteractionData { *; }
-keep class apptentive.com.android.encryption.** { *; }

# Gson library
-keepattributes Signature
-keepattributes *Annotation*
-dontwarn sun.misc.**
-keep class com.google.gson.** { *; }
-keep class org.apache.commons.io.** { *; }
-keep class org.apache.commons.logging.** { *; }
Basic Standard Market Research HR Professional Full Access Reporting
Free Individual Team & Enterprise
Feature Included In