Xamarin Android initialization for Mapp Cloud
Create a new Xamarin Android application in Visual Studio/Xamarin Studio
Add.dll into your project: open the Solution Explorer →  right-click on the References → Choose Add Reference-> Click on Browse option (on the bottom right angle) →  browse the binding file (.dll), and click OK
Add Google Play Service into your project: right-click on Packages → Add Google Play Service → select  InstanceID, Messaging, Identity, Location and click Add Packages
Mapp Android library requires the following dependencies (those dependencies can be downloaded using NuGet):Â
Google.Gson
Xamarin.Android.GlideÂ
Xamarin.Google.Dagger
Xamarin.AndroidX.Media
Add the Google Service Json file
Copy google-services.json to the project folder
Add google-services.json to the app project
Right-click google-services.json
Set the Build Action to GoogleServicesJsonÂ
Â
The project must be on AndroidX and use Dex Compiler D8
Create a class that extends Application. At the beginning of class import binding application: Â
using Appoxee; using Android.Gms.Common; using Appoxee.Push;
And add the following code snippet:Â[Service] [IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })] [Application] public class MappApp : Application { const string TAG = "MyFirebaseIIDService"; public MappApp(IntPtr handle, JniHandleOwnership ownerShip) : base(handle, ownerShip) { } public override void OnCreate() { base.OnCreate(); AppoxeeOptions opt = new AppoxeeOptions(); opt.SdkKey = "SDK_KEY"; opt.GoogleProjectId = "GOOGLE_PROJECT_ID"; opt.CepURL = "CEP_URL"; opt.AppID = "APP_ID"; opt.TenantID = "TENANT_ID"; opt.NotificationMode = NotificationModes.BackgroundAndForeground; opt.Server = AppoxeeOptions.ServerForUsing.Test; Appoxee.EngageApoxee.Engage(this, opt); // } public bool IsPlayServicesAvailable() { int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.Success) { if (GoogleApiAvailability.Instance.IsUserResolvableError(resultCode)) Android.Util.Log.Debug(TAG, GoogleApiAvailability.Instance.GetErrorString(resultCode)); else { Android.Util.Log.Debug(TAG, "This device is not supported"); //Finish(); } return false; } else { Android.Util.Log.Debug(TAG, "Google Play Services is available."); return true; } } }
NotificationMode is an enum and you can choose one of three options:BACKGROUND_ONLY - notification will show only when an app is closed or in idle mode.
BACKGROUND_AND_FOREGROUND - notification will show every time when a push notification comes.
SILENT_ONLY - notification never shows on the device.
If you don't choose one of these options, by default is BACKGROUND_ONLY. Â
AppoxeeOptions.The server is an enum and you can choose one of four options:
L3
EMC
CROC
TEST
An account manager will provide you info which one you should use in your application (L3, EMC or CROC). If you don't choose one of these options, by default is a TEST.Â
Our developers use TEST for development purposes and you shouldn't use this one.In AndroidManifest.xml mandatory add internet permission:
<uses-permission android:name="android.permission.INTERNET" />
Within application tag you must add a receiver for push notification:Â
Add a callback when Engage finished all initialization, the callback will be called when Engaged is up and ready, or if server hand-shaking is failed.