Apptentive.Android
4.1.0
See the version list below for details.
dotnet add package Apptentive.Android --version 4.1.0
NuGet\Install-Package Apptentive.Android -Version 4.1.0
<PackageReference Include="Apptentive.Android" Version="4.1.0" />
paket add Apptentive.Android --version 4.1.0
#r "nuget: Apptentive.Android, 4.1.0"
// Install Apptentive.Android as a Cake Addin #addin nuget:?package=Apptentive.Android&version=4.1.0 // Install Apptentive.Android as a Cake Tool #tool nuget:?package=Apptentive.Android&version=4.1.0
Apptentive Xamarin Android SDK
Register Apptentive
Register Apptentive in your Application class.
using System;
using Android.App;
using Android.Runtime;
using ApptentiveSDK.Android;
namespace ApptentiveSample
{
[Application]
public class MyApplication : Application
{
public MyApplication(IntPtr handle, JniHandleOwnership ownerShip)
: base(handle, ownerShip)
{
}
public override void OnCreate()
{
base.OnCreate();
Apptentive.Register(this, "Your Apptentive Key", "Your Apptentive Signature");
}
}
}
Make sure you use the Apptentive App Key and Signature for the Android app you created in the Apptentive console. Sharing these keys between two apps, or using keys from the wrong platform is not supported, and will lead to incorrect behavior. You can find them here.
Message Center
See: How to Use Message Center
Showing Message Center
With the Apptentive Message Center your customers can send feedback, and you can reply, all without making them leave the app. Handling support inside the app will increase the number of support messages received and ensure a better customer experience.
Message Center lets customers see all the messages they have send you, read all of your replies, and even send screenshots that may help debug issues.
Add Message Center to talk to your customers.
Find a place in your app where you can add a button that opens Message Center. Your setings page is a good place.
var messageCenterButton = FindViewById<Button>(...);
messageCenterButton.Click += delegate
{
Apptentive.ShowMessageCenter(context);
};
Checking Unread Message Count
You can also check to see how many messages are waiting to be read in the customer’s Message Center.
var unreadMessageCount = Apptentive.UnreadMessageCount;
if (unreadMessageCount > 0)
{
Console.WriteLine("You have {0} unread messages", unreadMessageCount);
}
Unread Message Count Notification
You can receive a callback when a new unread message comes in. You can use this callback to notify your customer, and display a badge letting them know how many unread messages are waiting for them. Because this listener could be called at any time, you should store the value returned from this method, and then perform any user interaction you desire at the appropriate time.
public class MainActivity : Activity, IUnreadMessagesListener
{
TextView unreadMessagesTextView;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
...
unreadMessagesTextView = FindViewById<TextView>(...);
Apptentive.AddUnreadMessagesListener(this);
}
public void OnUnreadMessageCountChanged(int count)
{
RunOnUiThread(delegate ()
{
unreadMessagesTextView.Text = "Unread messages: " + Apptentive.UnreadMessageCount;
});
}
}
The listener will not be run on the UI thread, and may be called from a different Activity than the one that is set on the listener. The correct way of setting Apptentive listeners is to create a listener with the same lifecycle as it’s intended usage, then passing it to Apptentive. For example, if the listener is going to be used in a specific activity, make the listener an Activity data member. This way, when the activity is gone, the listener will automatically be garbage collected and Apptentive will know about this through WeakReference (and we’ll stop calling the listener).
Events
Events record user interaction. You can use them to determine if and when an Interaction will be shown to your customer. You will use these Events later to target Interactions, and to determine whether an Interaction can be shown. You trigger an Event with the Engage()
method. This will record the Event, and then check to see if any Interactions targeted to that Event are allowed to be displayed, based on the logic you set up in the Apptentive Dashboard.
var engageButton = FindViewById<Button>(...);
engageButton.Click += delegate
{
Apptentive.Engage(this, "my_event");
};
You can add an Event almost anywhere in your app, just remember that if you want to show an Interaction at that Event, it needs to be a place where launching an Activity will not cause a problem in your app.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
MonoAndroid | monoandroid70 is compatible. |
-
MonoAndroid 7.0
- Xamarin.Android.Support.Design (>= 25.4.0.2)
- Xamarin.Android.Support.v4 (>= 25.4.0.2)
- Xamarin.Android.Support.v7.AppCompat (>= 25.4.0.2)
- Xamarin.Android.Support.v7.CardView (>= 25.4.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.1.0 | 5,381 | 8/1/2023 |
6.0.2 | 209 | 7/6/2023 |
6.0.1 | 3,861 | 5/11/2023 |
6.0.0 | 262 | 5/3/2023 |
5.8.4 | 35,979 | 9/29/2022 |
5.8.3 | 7,903 | 3/23/2022 |
5.8.2 | 2,844 | 2/18/2022 |
5.8.1 | 475 | 2/17/2022 |
5.8.0 | 504 | 1/12/2022 |
5.7.1 | 1,515 | 8/26/2021 |
5.7.0 | 378 | 8/4/2021 |
5.6.5 | 423 | 7/28/2021 |
5.6.4 | 371 | 7/7/2021 |
5.6.3 | 408 | 2/4/2021 |
5.6.2 | 5,755 | 1/13/2021 |
5.6.1 | 1,002 | 12/7/2020 |
5.6.0 | 805 | 9/28/2020 |
5.5.4 | 2,442 | 9/8/2020 |
5.5.3 | 766 | 6/1/2020 |
5.4.2 | 12,156 | 5/14/2019 |
5.4.0 | 9,300 | 1/29/2019 |
5.3.2 | 754 | 12/6/2018 |
5.3.1 | 766 | 10/29/2018 |
5.3.0 | 806 | 10/19/2018 |
5.1.0 | 5,674 | 5/14/2018 |
5.0.0 | 1,127 | 1/23/2018 |
4.1.0 | 1,728 | 11/9/2017 |
Apptentive Android SDK 4.1.2