36
Adobe ® Experience Cloud Xamarin Components for Experience Cloud Solutions 4.x SDK

Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Embed Size (px)

Citation preview

Page 1: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Adobe® Experience Cloud

Xamarin Components for Experience CloudSolutions 4.x SDK

Page 2: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Contents

Xamarin Components for Experience Cloud Solutions 4.x SDK...................................3

Making Calls to the Library..............................................................................................5

Implement Lifecycle.........................................................................................................6

Android..............................................................................................................................7Android Methods...............................................................................................................................................................7

Classes, Enums, and Interfaces...................................................................................................................................17

iOS....................................................................................................................................21iOS Methods......................................................................................................................................................................21

Classes and Enums..........................................................................................................................................................31

Xamarin Components for Experience CloudSolutions 4.x SDK

Last updated 3/8/2018

Page 3: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Xamarin Components for Experience Cloud Solutions 4.xSDKThis topic describes how to get started using Xamarin components for Mobile solutions 4.x SDK.

Last Updated:October 20, 2016

This section contains the following information:

• Getting Started• Android• iOS• Xamarin Components

Getting Started

Download the Xamarin components from GitHub or https://components.xamarin.com/.

Android

Import the ADBMobile Component to your Xamarin.Android Project:

1. Open your Xamarin Project2. Open References dialog, and then .Net Assembly tab.3. Select ADBMobile.XamarinAndroidBinding.dll from the folder lib/Android.4. Add your ADBMobileConfig.json file into the Assets folder of your project. 5. Add permissions for:

• INTERNET• ACCESS_NETWORK_STATE

<uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Add the following activity and receiver if you are using In-app messaging:<activity android:name="com.adobe.mobile.MessageFullScreenActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" /><receiver android:name="com.adobe.mobile.MessageNotificationHandler" />

Add the following receiver if you are using acquisition:<receiver android:name="com.your.package.name.GPBroadcastReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter></receiver>

iOS

Import the ADBMobile Component to your Xamarin.iOS Project:

1. Open your Xamarin Project.2. Open References dialog, and then .Net Assembly tab.3. Select ADBMobile.XamarinIOSBinding.dll from the folder lib/ios-unified.4. Add your ADBMobileConfig.json file to the project.

3Xamarin Components for Experience CloudSolutions 4.x SDK

Page 4: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Xamarin Components

Get the components from Xamarin Components Store:

1. Open your Xamarin Project.2. Select Component and then Get More Components.3. Search Adobe Mobile Services SDK add the component to the current project.4. Add your ADBMobileConfig.json file to the project.

4Xamarin Components for Experience CloudSolutions 4.x SDK

Page 5: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Making Calls to the LibraryInformation to help you make calls to the plugin from your scripts.

When you want to make calls to the plugin from your scripts, you must import the namespace.

Using Com.Adobe.Mobile:

• iOS: Once you have imported the namespace, you can make calls directly to the SDK via the static methods of the ADBMobileclasses.

• Android: You can make calls directly to the SDK via the static methods of theConfig/Analytics/Target/AudienceManager/Media classes.

5Making Calls to the Library

Page 6: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

Implement LifecycleInformation to help you implement Lifecycle metrics for Android. Lifecycle metrics are automatically collected for iOS.

See Lifecycle Metrics for the metrics and dimensions that can be measured automatically by the mobile library after lifecycle isimplemented.

iOS

For iOS, lifecycle metrics are automatically collected.

Android

In your main activity, you need to set the application context for the Android SDK.protected override void OnCreate (Bundle bundle){ ... Config.SetContext (Application.Context); ...}

In every activity, you need to implement lifecycle calls.protected override void OnResume(){ ... Config.CollectLifecycleData (this); ...}

protected override void OnPause(){ ... Config.PauseCollectingLifecycleData (); ...}

6Implement Lifecycle

Page 7: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

AndroidThis section contains information relating to using the Adobe Mobile SDK Xamarin component for Android.

Android Methods

Android methods for Xamarin components for Experience Cloud solutions 4.x SDK.

This section contains the following information:

• Configuration Methods• Analytics Methods• Experience Cloud ID Methods• Target Methods• Audience Manager• Video

Configuration Methods

DescriptionMethod Name

Returns the current debug logging preference. Default: falseDebugLogging

Syntax:public static Boolean DebugLogging;

Example:getter: var debuglog = Config.DebugLogging;setter: Config.DebugLogging = (Java.Lang.Boolean)true;

Returns the lifetime value of the current user.LifetimeValue

Syntax:public static BigDecimal LifetimeValue;

Example:var lifetimeValue = Config.LifetimeValue;

Returns the enum representation of the privacy status for current user.PrivacyStatus

ADBMobilePrivacyStatus.OptIn - hits are sent immediately.

ADBMobilePrivacyStatus.OptOut - hits are discarded.

ADBMobilePrivacyStatus.Unknown - If offline tracking is enabled, hits are saved until theprivacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If offlinetracking is not enabled, hits are discarded until the privacy status changes to opt in.

Default: The default value is set in ADBMobileConfig.json.

Syntax:public static MobilePrivacyStatus PrivacyStatus;

7Android

Page 8: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:getter: var privacyStatus = Config.PrivacyStatus;setter: Config.PrivacyStatus = MobilePrivacyStatus.MobilePrivacyStatusUnknown;

Returns the custom user identifier if a custom identifier has been set. Returns null if a customidentifier is not set.

UserIdentifier

Default: null

Syntax: public static string UserIdentifier();

Example:getter: var userId = Config.UserIdentifier;setter: Config.UserIdentifier = "imBatman";

Gets the library version.Version

Syntax:public static string Version;

Example:var version = ADBMobile.Version;

Indicates to the SDK that your app is paused, so that lifecycle metrics are calculated correctly. Forexample, on pause collects a timestamp to determine previous session length. This also sets a flag

PauseCollectingLifecycleData

so that lifecycle correctly knows that the app did not crash. For more information, see LifecycleMetrics.

Syntax:public static void PauseCollectingLifecycleData ();

Example:Config.PauseCollectingLifecycleData();

(4.2 or later) Indicates to the SDK that lifecycle data should be collected for use across all solutionsin the SDK. For more information, see Lifecycle Metrics.

CollectLifecycleData(Activity activity)

Syntax:public static void collectLifecycleData(Activity activity);

Example:Config.CollectLifecycleData (this);

(4.2 or later) Indicates to the SDK that lifecycle data should be collected for use across all solutionsin the SDK. See Lifecycle Metrics.

CollectLifecycleData(Activity activity)

8Android

Page 9: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Syntax:public static void collectLifecycleData(Activity activity, IDictionary<string, Object> context));

Example:IDictionary<string, Java.Lang.Object> context = new Dictionary<string, Java.Lang.Object> ();context.Add ("key", "value");Config.CollectLifecycleData (this, context);

(4.2 or later) Lets you load a different ADBMobile JSON Config file when the application starts.The different configuration is used until the application is closed.

OverrideConfigStream

Syntax:public static void OverrideConfigStream (Stream strem);

Example:Stream st1 = Assets.Open ("ADBMobileConfig-2.json");Config.OverrideConfigStream (st1);

(4.2 or later) Set the large icon that will be used for notifications created by the SDK. This icon willbe the primary image shown when the user sees the full notification in the notification center.

SetLargeIconResourceId(intresourceId)

Syntax:public static void SetLargeIconResourceId( int resourceId);

Example:Config.SetLargeIconResourceId(R.drawable.appIcon);

(4.2 or later) Set the small icon that will be used for notifications created by the SDK. This icon willshow up in the status bar. This will also be the secondary image shown when the user sees the fullnotification in the notification center.

SetSmallIconResourceId(intresourceId)

Syntax:public static void SetSmallIconResourceId( int resourceId);

Example:Config.SetSmallIconResourceId(R.drawable.appIcon);

Analytics Methods

DescriptionMethod Name

Returns the automatically generated ID for Analytics. This is an app-specific unique IDthat is generated on initial launch and then stored and used from that point forward.This ID is preserved between app upgrades, and is removed on uninstall.

TrackingIdentifier

Syntax:public static string TrackingIdentifier;

9Android

Page 10: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:Var trackingId = Analytics.TrackingIdentifier

Tracks an app state with optional context data. States are the views that are available inyour app, such as "title screen", "level 1", "pause", and so on. These states are similar topages on a website, and TrackState calls increment page views.

TrackState

If state is empty, it displays as "app name app version (build)" in reports. If you see thisvalue in reports, make sure you are setting state in each TrackState call.

Note: This is the only tracking call that increments page views.

Syntax:public static void TrackState (string state, IDictionary<string, Object> cdata);

Example:var cdata = new Dictionary<string, Java.Lang.Object> ();cdata.Add ("key", (Java.Lang.Object)"value");Analytics.TrackState ("stateName", (IDictionary<string, Java.Lang.Object>)cdata);

Tracks an action in your app. Actions are the things that happen in your app that youwant to measure, such as "deaths", "level gained", "feed subscriptions", and other metrics.

TrackAction

Note: If you have code that might run while the app is in the background (for example,a background data retrieval), use trackActionFromBackground instead.

Syntax:public static void TrackAction(string action, IDictionary<string, Object> cdata);

Example:var cdata = new Dictionary<string, Java.Lang.Object> ();cdata.Add ("key", (Java.Lang.Object)"value");Analytics.TrackAction ("actionName", (IDictionary<string, Java.Lang.Object>)cdata);

Sends the current latitude and longitude coordinates. Also uses points of interest definedin the ADBMobileConfig.json file to determine if the location provided as a parameter

TrackLocation

is within any of your POI. If the current coordinates are within a defined POI, a contextdata variable is populated and sent with the TrackLocation call.

Syntax:public static void TrackLocation(Location location, IDictionary<string, Object> cdata);

Example:Location loc = new Location(LocationManager.GpsProvider);;loc.Latitude = 111;loc.Longitude = 44;loc.Accuracy = 5;Analytics.TrackLocation (loc, null);

10Android

Page 11: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Tracks when a users enters proximity of a beacon.TrackBeacon

Syntax:public static void TrackBeacon (string uuid, string major, string minor, Analytics.BEACON_PROXIMITY prox, IDictionary<string, Object> cdata);

Example:Analytics.TrackBeacon ("UUID", "1", "2", Analytics.BEACON_PROXIMITY.ProximityImmediate, null);

Clears beacons data after a user leaves the proximity of the beacon.ClearBeacon

Syntax:public static void TrackingClearCurrentBeacon();

Example:Analytics.ClearBeacon();

Adds amount to the user's lifetime value.TrackLifetimeValueIncrease

Syntax:public static void TrackLifetimeValueIncrease(double amount, IDictionary<string, Object> cdata);

Example:Analytics.TrackLifetimeValueIncrease(5, null);

Start a timed action with name action.TrackTimedActionStart

If you call this method for an action that has already started, the previous timed actionis overwritten.

Note: This call does not send a hit.

Syntax:public static void TrackTimedActionStart(string action, IDictionary<string, Object> cdata);

Example:Analytics.TrackTimedActionStart("level2", null);

Pass in data to update the context data associated with the given action.TrackTimedActionUpdate

The data passed in is appended to the existing data for the given action, and overwritesthe data if the same key is already defined for action.

Note: This call does not send a hit.

Syntax:public static void TrackTimedActionUpdate(string action, IDictionary<string, Object> cdata);

11Android

Page 12: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:var updatedData = new Dictionary<string, Java.Lang.Object> ();cdata.Add ("key", (Java.Lang.Object)"value"); Analytics.TrackTimedActionUpdate("level2", updatedData);

End a timed action.TrackTimedActionEnd

Syntax:public static void TrackTimedActionEnd(string action, Analytics.ITimedActionBlock block);

Example:Analytics.TrackTimedActionEnd ("level2", new TimedActionBlock());

class TimedActionBlock: Java.Lang.Object, Analytics.ITimedActionBlock{ public Java.Lang.Object Call (long inAppDuration, long totalDuration, IDictionary<string, Java.Lang.Object> contextData){

return Java.Lang.Boolean.True; }}

Returns whether or not a timed action is in progress.TrackingTimedActionExists

Syntax:public static bool TrackingTimedActionExists(string action);

Example:var level2InProgress = Analytics.TrackingTimedActionExists("level2");

Forces the library to send all hits in the offline queue no matter how many are currentlyqueued.

SendQueuedHits

Syntax:public static void SendQueuedHits();

Example:Analytics.SendQueuedHits();

Clears all hits from the offline queue.ClearQueue

Syntax:public static void ClearQueue();

Example:Analytics.ClearQueue();

Retrieves the number of hits currently in the offline queue.QueueSize

Syntax:public static long QueueSize();

12Android

Page 13: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:var queueSize = Analytics.QueueSize();

Experience Cloud ID Methods

DescriptionMethod Name

Retrieves the Experience Cloud ID from the ID service.MarketingCloudId

Syntax:public static string MarketingCloudId;

Example:var mcid = Visitor.MarketingCloudId;

With the Experience Cloud ID, you can set additional customer IDs to associate with eachvisitor. The Visitor API accepts multiple Customer IDs for the same visitor, with a customer

SyncIdentifiers

type identifier to separate the scope of the different customer IDs. This method correspondsto setCustomerIDs in the JavaScript library.

Syntax:public static void SyncIdentifiers((IDictionary<string, string> identifiers);

Example:IDictionary<string, string> ids = new Dictionary<string, string> ();ids.Add ("pushID", "value2");Visitor.SyncIdentifiers (ids);

Target Methods

DescriptionMethod Name

Sends request to your configured Target server and returns the string value of the offer generatedin a Action<NSDictionary> callback.

LoadRequest

Syntax:public static void LoadRequest (TargetLocationRequest request, Target.ITargetCallback callback);

Example:class TargetBlock: Java.Lang.Object, Target.ITargetCallback{ public void Call (Java.Lang.Object content) { Console.WriteLine (content.ToString()); }}var req = Target.CreateRequest ("AndroidTest", "defGal", parameters); Target.LoadRequest (req, new TargetBlock());

13Android

Page 14: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Convenience constructor to create an ADBTargetLocationRequest object with the givenparameters.

CreateRequest

Syntax:public static TargetLocationRequest TargetCreateRequest (string name, string defaultContent, IDictionary<string, string> parameters);

Example:IDictionary<string, Java.Lang.Object> parameters = new Dictionary<string, Java.Lang.Object> (); parameters.Add ("key1", "value2");var req = Target.CreateRequest ("AndroidTest", "defGal", parameters);

Creates an ADBTargetLocationRequest.CreateOrderConfirmRequest

Syntax:public static TargetLocationRequest TargetCreateRequest (string name, string defaultContent, IDictionary<string, string> parameters);

Example:var orderConfirm = Target.CreateOrderConfirmRequest ("myOrder", "12345", "29.41", "cool stuff", null);

Clears any target cookies from your app.ClearCookies

Syntax:public static void ClearCookies();

Example:Target.ClearCookies ();

Audience Manager

DescriptionMethod Name

Returns the visitor profile that was most recently obtained. Returns nil if no signal has beensubmitted yet. Visitor profile is saved in NSUserDefaults for easy access across multiplelaunches of your app.

VisitorProfile

Syntax:public static IDictionary<string, Object> VisitorProfile;

Example:NSDictionary profile = AudienceManager.VisitorProfile;

Returns the current DPID.Dpid

Syntax:public static string Dpuuid;

14Android

Page 15: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:string currentDpid = AudienceManager.Dpid;

Returns the current DPUUID.Dpuuid

Syntax:public static string AudienceDpuuid;

Example:string currentDpuuid = AudienceManager.Dpuuid;

Sets the dpid and dpuuid. If dpid and dpuuid are set, they will be sent with each signal.AudienceSetDpidAndDpuuid

Syntax:public static void AudienceSetDpidAndDpuuid (string Dpid, String Dpuuid);

Example:AudienceManager.SetDpidAndDpuuid ("testDpid", "testDpuuid");

Sends audience management a signal with traits and get the matching segments returned in aAction<NSDictionary> callback.

SignalWithData

Syntax:public static void SignalWithData (IDictionary<string, Object> audienceData, AudienceManager.IAudienceManagerCallback callback);

Example:class AudienceManagerCallback: Java.Lang.Object, AudienceManager.IAudienceManagerCallback{ public void Call (Java.Lang.Object content) { Console.WriteLine (content.ToString()); }}IDictionary<string, Java.Lang.Object> traits = new Dictionary<string, Java.Lang.Object> (); traits.Add ("trait", "b");

AudienceManager.SignalWithData (traits, new AudienceManagerCallback());

Resets audience manager UUID and purges current visitor profile.Reset

Syntax:public static void Reset ();

Example:AudienceManager.Reset ();

Video

More information is available at here.

15Android

Page 16: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Returns an MediaSettings object with specified parameters.MediaSettings

Syntax:public static MediaSettings SettingsWith (string name, double length, string playerName, string playerID);

Example:MediaSettings settings = Media.SettingsWith ("name1", 10, "playerName1", "playerID1");

Returns an MediaSettings object for use with tracking an ad video.AdSettingsWith

Syntax:public static MediaSettings AdSettingsWith ( string name, double length, string playerName, string parentName, string parentPod, double parentPodPosition, string CPM);

Example:MediaSettings adSettings = Media.AdSettingsWith ("adName1", 2, "playerName1", "name1", "podName1", 4, "CPM1");

Opens an ADBMediaSettings object for tracking.Open

Syntax:public static void Open (MediaSettings settings, Media.IMediaCallback callback);

Example:MediaSettings settings = Media.SettingsWith ("name1", 10, "playerName1", "playerID1"); Media.Open (settings, new MediaCallback()); class MediaCallback: Java.Lang.Object, Media.IMediaCallback{public void Call (Java.Lang.Object content){

}}

Closes the media item named name.Close

Syntax:public static void Close( string name);

Example:Media.Close (settings.Name);

Plays the media item named name at the given offset (in seconds).Play

Syntax:public static void Play ( string name, double offset);

Example:Media.Play (settings.Name, 0);

16Android

Page 17: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Manually mark the media item as complete at the offset provided (in seconds).Complete

Syntax:public static void Complete ( string name, double offset);

Example:Media.Complete (settings.Name, 5);

Notifies the media module that the video has been stopped or paused at the given offset.Stop

Syntax:public static void Stop ( string name, double offset);

Example:Media.Stop (settings.Name, 3);

Notifies the media module that the media item has been clicked.Click

Syntax:public static void Click ( string name, double offset);

Example:Media.Click (settings.Name, 3);

Sends a track action call (no page view) for the current media state.Track

Syntax:public static void Track ( string name, NSDictionary data);

Example:Media.Track (settings.Name, null);

Classes, Enums, and Interfaces

List of classes and enumerations for use in Xamarin applications.

This section contains the following information:

• Classes• Enumerations• Interfaces

Classes

MediaEventType

public class MediaEventType : Object{ public const int MediaEventTypeClick;

public const int MediaEventTypeTrack;

17Android

Page 18: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

public const int MediaEventTypeStop;

public const int MediaEventTypeClose;

public const int MediaEventTypeComplete;

public const int MediaEventTypeMonitor;

public const int MediaEventTypePlay;

public MediaEventType ();}

TargetLocationRequest

public class TargetLocationRequest : Object{ public const string TargetParameterCategoryId = "categoryId";

public const string TargetParameterProductPurchaseId = "purchasedProductIds";

public const string TargetParameterMbox3rdpartyId = "mbox3rdPartyId";

public const string TargetParameterMboxHost = "mboxHost";

public const string TargetParameterMboxPageValue = "mboxPageValue";

public const string TargetParameterMboxPc = "mboxPC";

public const string TargetParameterMboxSessionId = "mboxSession";

public const string TargetParameterOrderId = "orderId";

public const string TargetParameterOrderTotal = "orderTotal";

public string DefaultContent { get; set; }

public string Name { get; set; }

public IDictionary Parameters { get; set; }}

VisitorID

public class VisitorID : Object{ public VisitorID.VisitorIDAuthenticationState AuthenticationState { get; set; }

public string Id { get; set; }

public string IdOrigin { get; set; }

18Android

Page 19: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

public string IdType { get; set; }}

Enumerations

MobileDataEvent

public sealed class MobileDataEvent : Enum{ public static Config.MobileDataEvent MobileEventAcquisitionInstall { get; }

public static Config.MobileDataEvent MobileEventAcquisitionLaunch { get; }

public static Config.MobileDataEvent MobileEventLifecycle { get; }

public static Config.MobileDataEvent ValueOf (string p0);

public static Config.MobileDataEvent[] Values ();}

MobilePrivacyStatus

public sealed class MobilePrivacyStatus : Enum{ public static MobilePrivacyStatus MobilePrivacyStatusOptIn { get; }

public static MobilePrivacyStatus MobilePrivacyStatusOptOut { get; }

public static MobilePrivacyStatus MobilePrivacyStatusUnknown { get; }

public static MobilePrivacyStatus ValueOf (string p0);

public static MobilePrivacyStatus[] Values ();}

VisitorIDAuthenticationState

public sealed class VisitorIDAuthenticationState : Enum{ public static VisitorID.VisitorIDAuthenticationState VisitorIdAuthenticationStateAuthenticated { get; }

public static VisitorID.VisitorIDAuthenticationState VisitorIdAuthenticationStateLoggedOut { get; }

public static VisitorID.VisitorIDAuthenticationState VisitorIdAuthenticationStateUnknown { get;

19Android

Page 20: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

}

public static VisitorID.VisitorIDAuthenticationState ValueOf (string p0);

public static VisitorID.VisitorIDAuthenticationState[] Values ();}

Interfaces

IAdobeDataCallback

public interface IAdobeDataCallback : IJavaObject, IDisposable{ void Call (Config.MobileDataEvent p0, IDictionary<string, Object> p1);}

ITimedActionBlock

public interface ITimedActionBlock : IJavaObject, IDisposable{ Object Call (long p0, long p1, IDictionary<string, Object> p2);}

IAudienceManagerCallback

public interface IAudienceManagerCallback : IJavaObject, IDisposable{ void Call (Object p0);}

IMediaCallback

public interface IMediaCallback : IJavaObject, IDisposable{ void Call (Object p0);}

ITargetCallback

public interface ITargetCallback : IJavaObject, IDisposable{ void Call (Object p0);}

20Android

Page 21: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

iOSThis section contains information relating to using the Adobe Mobile SDK Xamarin component for iOS.

iOS Methods

iOS methods for Xamarin components for Experience Cloud solutions 4.x SDK.

This section contains the following information:

• Configuration Methods• Analytics Methods• Experience Cloud ID Methods• Target Methods• Audience Manager• Video

Configuration Methods

DescriptionMethod Name

Indicates to the SDK that lifecycle data should be collected for use across all solutions in the SDK.For more information, see Lifecycle Metrics.

CollectLifecycleData

Syntax:public static void CollectLifecycleData();

Example:ADBMobile.CollectLifecycleData();

Returns the current debug logging preference. Default: falseDebugLogging

Syntax:public static bool DebugLogging();

Example:var debugEnabled = ADBMobile.DebugLogging();

Sets the debug logging preference to enabled.SetDebugLogging

Syntax:public static void SetDebugLogging(bool enabled);

Example:ADBMobile.SetDebugLogging(true);

Returns the lifetime value of the current user.LifetimeValue

Syntax:public static double LifetimeValue();

21iOS

Page 22: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:var lifetimeValue = ADBMobile.LifetimeValue();

Returns the enum representation of the privacy status for current user.PrivacyStatus

ADBMobilePrivacyStatus.OptIn - hits are sent immediately.

ADBMobilePrivacyStatus.OptOut - hits are discarded.

ADBMobilePrivacyStatus.Unknown - If offline tracking is enabled, hits are saved until theprivacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If offlinetracking is not enabled, hits are discarded until the privacy status changes to opt in.

Default: The default value is set in ADBMobileConfig.json

Syntax:public static ADBPrivacyStatus PrivacyStatus();

Example:var privacyStatus = ADBMobile.PrivacyStatus();

Sets the privacy status for the current user to status. Set to one of the following values:SetPrivacyStatus

ADBMobilePrivacyStatus.OptIn - hits are sent immediately.

ADBMobilePrivacyStatus.OptOut - hits are discarded.

ADBMobilePrivacyStatus.Unknown - If offline tracking is enabled, hits are saved until theprivacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If offlinetracking is not enabled, hits are discarded until the privacy status changes to opt in.

Syntax:public static void SetPrivacyStatus(ADBPrivacyStatus status)

Example:ADBMobile.SetPrivacyStatus(ADBMobilePrivacyStatus.OptIn );

Returns the custom user identifier if a custom identifier has been set. Returns null if a customidentifier is not set. Default: null

UserIdentifier

Syntax:public static string UserIdentifier();

Example:var userId = ADBMobile.UserIdentifier();

Returns the custom user identifier if a custom identifier has been set. Returns null if a customidentifier is not set. Default: null.

SetUserIdentifier

Syntax:public static string UserIdentifier();

22iOS

Page 23: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:ADBMobile.SetUserIdentifier ("customUserIdentifier”);

Gets the library version.GetVersion

Syntax:public static string Version();

Example:var version = ADBMobile.Version();

Indicates to the SDK that your next resume from background should not start a new session,regardless of the value of lifecycle session timeout in your config file.

KeepLifecycleSessionAlive(iOS only)

Note: this method is intended to be used for apps that register for notifications while in backgroundand should only be called from your code that runs while your app is in the background.

Syntax:public static void KeepLifecycleSessionAlive();

Example:ADBMobile.KeepLifecycleSessionAlive();

Analytics Methods

DescriptionMethod Name

Retrieves the analytics tracking identifier.TrackingIdentifier

Syntax:public static string TrackingIdentifier();

Example:var trackingId = ADBMobile.TrackingIdentifier();

Tracks an app state with optional context data. States are the views that are available in yourapp, such as "title screen", "level 1", "pause", and so on. These states are similar to pages on awebsite, and TrackState calls increment page views.

TrackState

If state is empty, it displays as "app name app version (build)" in reports. If you see this value inreports, make sure you are setting state in each TrackState call.

Note: This is the only tracking call that increments page views.

Syntax:public static void TrackState(string state, NSDictionary cdata);

Example:NSDictionary contextData; contextData = NSDictionary.FromObjectAndKey (NSObject.FromObject("val"),

23iOS

Page 24: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name NSObject.FromObject("key")); ADBMobile.TrackState("title screen", contextData);

Tracks an action in your app. Actions are the things that happen in your app that you want tomeasure, such as "deaths", "level gained", "feed subscriptions", and other metrics.

TrackAction

Note: If you have code that might run while the app is in the background (for example, abackground data retrieval), use trackActionFromBackground instead.

Syntax:public static void TrackAction(string action, NSDictionary cdata);

Example:ADBMobile.TrackAction("level gained", null);

Tracks an action that occurred in the background. This suppresses lifecycle events from firingin certain scenarios.

TrackActionFromBackground(iOS only)

Note: This method should only be called in code that runs while your app is in the background.

Syntax:public static void TrackActionFromBackground(string action, NSDictionary cdata);

Example:ADBMobile.TrackActionFromBackground("majorLocationChange", null);

Sends the current latitude and longitude coordinates. Also uses points of interest defined in theADBMobileConfig.json file to determine if the location provided as a parameter is within

TrackLocation

any of your POI. If the current coordinates are within a defined POI, a context data variable ispopulated and sent with the TrackLocation call.

Syntax:public static void TrackLocation(CLLocation location, NSDictionary cdata);

Example:CoreLocation.CLLocation l = new CoreLocation.CLLocation (111.111, 44.156);ADBMobile.TrackLocation (l, null);

Tracks when a users enters proximity of a beacon.TrackBeacon

Syntax:public static void TrackBeacon( CLBeacon beacon, NSDictionary cdata);

Example:CoreLocation.CLBeacon beacon = new CoreLocation.CLBeacon ();ADBMobile.TrackBeacon (beacon, null);

Clears beacons data after a user leaves the proximity of the beacon.TrackingClearCurrentBeacon

24iOS

Page 25: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Syntax:public static void TrackingClearCurrentBeacon();

Example:ADBMobile.TrackingClearCurrentBeacon();

Adds amount to the user's lifetime value.TrackLifetimeValueIncrease

Syntax:public static void TrackLifetimeValueIncrease(double amount, NSDictionary cdata);

Example:ADBMobile.TrackLifetimeValueIncrease(5, null);

Start a timed action with name action.TrackTimedActionStart

If you call this method for an action that has already started, the previous timed action isoverwritten.

Note: This call does not send a hit.

Syntax:public static void TrackTimedActionStart(string action, NSDictionary cdata);

Example:ADBMobile.TrackTimedActionStart("level2", null);

Pass in data to update the context data associated with the given action.TrackTimedActionUpdate

The data passed in is appended to the existing data for the given action, and overwrites the dataif the same key is already defined for action.

Note: This call does not send a hit.

Syntax:public static void TrackTimedActionUpdate(string action, NSDictionary cdata);

Example:NSDictionary updatedData = NSDictionary.FromObjectAndKey (NSObject.FromObject ("val2"), NSObject.FromObject ("key2")); ADBMobile.TrackTimedActionUpdate("level2", updatedData);

End a timed action.TrackTimedActionEnd

Syntax:public static void TrackTimedActionEnd(string action, Func<double, double, NSMutableDictionary, sbyte> block);

25iOS

Page 26: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:ADBMobile.TrackTimedActionEnd ("level2", (double arg1, double arg2, NSMutableDictionary arg3) => {return Convert.ToSByte(true);});

Returns whether or not a timed action is in progress.TrackingTimedActionExists

Syntax:public static bool TrackingTimedActionExists(string action);

Example:ADBMobile.TrackTimedActionEnd ("timedAction", (double inAppDuration, double totalDuration, NSMutableDictionary data) => { return true;});

Forces the library to send all hits in the offline queue no matter how many are currently queued.TrackingSendQueuedHits

Syntax:public static void TrackingSendQueuedHits();

Example:ADBMobile.TrackingSendQueuedHits();

Clears all hits from the offline queue.TrackingClearQueue

Syntax:public static void TrackingClearQueue();

Example:ADBMobile.TrackingClearQueue();

Retrieves the number of hits currently in the offline queue.TrackingGetQueueSize

Syntax:public static int TrackingGetQueueSize();

Example:var queueSize = ADBMobile.TrackingGetQueueSize();

Experience Cloud ID Methods

DescriptionMethod Name

Retrieves the Experience Cloud ID from the ID service.GetMarketingCloudID

Syntax:public static string GetMarketingCloudID();

26iOS

Page 27: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:var mcid = ADBMobile.GetMarketingCloudID();

With the Experience Cloud ID, you can set additional customer IDs to associate with eachvisitor. The Visitor API accepts multiple Customer IDs for the same visitor, along with a

VisitorSyncIdentifiers

customer type identifier to separate the scope of the different customer IDs. This methodcorresponds to setCustomerIDs in the JavaScript library.

Syntax:public static void VisitorSyncIdentifiers(NSDictionary identifiers);

Example:NSDictionary ids = NSDictionary.FromObjectAndKey (NSObject.FromObject ("value2"), NSObject.FromObject ("pushID")); ADBMobile.VisitorSyncIdentifiers(ids);

Target Methods

DescriptionMethod Name

Sends request to your configured Target server and returns the string value of the offer generatedin a Action<NSDictionary> callback.

TargetLoadRequest

Syntax:public static void TargetLoadRequest (ADBTargetLocationRequest request, Action<NSString> callback);

Example:NSDictionary dict = NSDictionary.FromObjectAndKey (NSObject.FromObject ("value2"), NSObject.FromObject ("key1"));ADBTargetLocationRequest req = ADBMobile.TargetCreateRequest ("iOSTest", "defGal", dict);ADBMobile.TargetLoadRequest(req, (context) => {Console.WriteLine (context);});

Convenience constructor to create an ADBTargetLocationRequest object with the givenparameters.

TargetCreateRequest

Syntax:public static ADBTargetLocationRequest ADBTargetLocationRequest TargetCreateRequest (string name, string defaultContent, NSDictionary parameters);

Example:NSDictionary dict = NSDictionary.FromObjectAndKey (NSObject.FromObject ("value2"), NSObject.FromObject ("key1"));ADBTargetLocationRequest req = ADBMobile.TargetCreateRequest ("iOSTest", "defGal", dict);

Creates an ADBTargetLocationRequest.TargetCreateOrderConfirmRequest

27iOS

Page 28: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Syntax:public static ADBTargetLocationRequest ADBTargetLocationRequest TargetCreateRequest (string name, string defaultContent, NSDictionary parameters);

Example:ADBMobile.TargetCreateOrderConfirmRequest ("myOrder", "12345", "29.41", "cool stuff", null);

Clears any target cookies from your app.TargetClearCookies

Syntax:public static void TargetClearCookies();

Example:ADBMobile.TargetClearCookies();

Audience Manager

DescriptionMethod Name

Returns the visitor profile that was most recently obtained. Returns nil if no signal has beensubmitted yet. Visitor profile is saved in NSUserDefaults for easy access across multiplelaunches of your app.

AudienceVisitorProfile

Syntax:public static NSDictionary AudienceVisitorProfile ();

Example:NSDictionary profile = ADBMobile.AudienceVisitorProfile();

Returns the current DPID.AudienceDpid

Syntax:public static string AudienceDpid ();

Example:string currentDpid = ADBMobile.AudienceDpid();

Returns the current DPUUID.AudienceDpuuid

Syntax:public static string AudienceDpuuid ();

Example:string currentDpuuid = ADBMobile.AudienceDpuuid();

Sets the dpid and dpuuid. If dpid and dpuuid are set, they will be sent with each signal.AudienceSetDpidAndDpuuid

28iOS

Page 29: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Syntax:public static void AudienceSetDpidAndDpuuid (NSDictionary data, Action<NSDictionary> callback);

Example:ADBMobile.AudienceSetDpidAndDpuuid ("testDppid", "testDpuuid");

Sends audience management a signal with traits and get the matching segments returned in aAction<NSDictionary> callback.

AudienceSignalWithData

Syntax:public static void AudienceSignalWithData (NSDictionary data, Action<NSDictionary> callback);

Example:NSDictionary audienceData = NSDictionary.FromObjectAndKey (NSObject.FromObject ("value2"), NSObject.FromObject ("key1"));ADBMobile.AudienceSignalWithData (audienceData, (context) => {Console.WriteLine (context);});

Resets audience manager UUID and purges current visitor profile.AudienceReset

Syntax:public static void AudienceReset ();

Example:ADBMobile.AudienceReset ();

Video

For more information, see Video Analytics.

DescriptionMethod Name

Returns an ADBMediaSettings object with specified parameters.MediaCreateSettings

Syntax:public static ADBMediaSettings MediaCreateSettings ([string name, double length, string playerName, string playerID);

Example:ADBMediaSettings settings = ADBMobile.MediaCreateSettings ("name1", 10, "playerName1", "playerID1");

Returns an ADBMediaSettings object for use with tracking an ad video.MediaAdCreateSettings

Syntax:public static ADBMediaSettings MediaAdCreateSettings ( string name, double length, string playerName, string parentName, string parentPod, double parentPodPosition, string CPM);

29iOS

Page 30: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Example:ADBMediaSettings adSettings = ADBMobile.MediaAdCreateSettings("adName1", 2, "playerName1", "name1", "podName1", 4, "CPM1");

Opens an ADBMediaSettings object for tracking.MediaOpenWithSettings

Syntax:public static void MediaOpenWithSettings ( ADBMediaSettings settings, Action<ADBMediaState> callback);

Example:ADBMediaSettings settings = ADBMobile.MediaCreateSettings ("name1", 10, "playerName1", "playerID1");ADBMobile.MediaOpenWithSettings (settings, (state) => {Console.WriteLine (state.Name);});

Closes the media item named name.MediaClose

Syntax:public static void MediaClose ( string name);

Example:ADBMobile.MediaClose (settings.Name);

Plays the media item named name at the given offset (in seconds).MediaPlay

Syntax:public static void MediaPlay ( string name, double offset);

Example:ADBMobile.MediaPlay (settings.Name, 0);

Manually mark the media item as complete at the offset provided (in seconds).MediaComplete

Syntax:public static void MediaComplete ( string name, double offset);

Example:ADBMobile.MediaComplete (settings.Name, 5);

Notifies the media module that the video has been stopped or paused at the given offset.MediaStop

Syntax:public static void MediaStop ( string name, double offset);

Example:ADBMobile.MediaStop (settings.Name, 3);

Notifies the media module that the media item has been clicked.MediaClick

30iOS

Page 31: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

DescriptionMethod Name

Syntax:public static void MediaClick ( string name, double offset);

Example:ADBMobile.MediaClick (settings.Name, 3);

Sends a track action call (no page view) for the current media state.MediaTrack

Syntax:public static void MediaTrack ( string name, NSDictionary data);

Example:ADBMobile.MediaTrack (settings.Name, null);

Classes and Enums

List of classes and enumerations for use in Xamarin applications.

This section contains the following information:

• Classes• Enumerations

Classes

ADBVisitorID

public class ADBVisitorID : NSObject{ public override IntPtr ClassHandle { get; }

public ADBVisitorID ();

public virtual ADBMobileVisitorAuthenticationState AuthenticationState ();

public virtual string Identifier ();

public virtual string IdType ();}

ADBTargetLocationRequest

public class ADBTargetLocationRequest : NSObject{

public override IntPtr ClassHandle { get; }

public virtual string DefaultContent { get; set; }

public virtual string Name {

31iOS

Page 32: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

get; set; }

public virtual NSMutableDictionary Parameters { get; set; }

public ADBTargetLocationRequest ();}

ADBMediaState

public class ADBMediaState : NSObject{ public virtual bool Ad { get; set; }

public override IntPtr ClassHandle { get; }

public virtual bool Clicked { get; set; }

public virtual bool Complete { get; set; }

public virtual bool EventFirstTime { get; set; }

public virtual nuint EventType { get; set; }

public virtual double Length { get; set; }

public virtual string MediaEvent { get; set; }

public virtual nuint Milestone { get; set; }

public virtual string Name { get; set; }

public virtual double Offset { get; set; }

32iOS

Page 33: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

public virtual nuint OffsetMilestone { get; set; }

public virtual NSDate OpenTime { get; set; }

public virtual double Percent { get; set; }

public virtual string PlayerName { get; set; }

public virtual string Segment { get; set; }

public virtual double SegmentLength { get; set; }

public virtual nuint SegmentNum { get; set; }

public virtual double TimePlayed { get; set; }

public virtual double TimePlayedSinceTrack { get; set; }

public virtual double Timestamp { get; set; }

public ADBMediaState ();}

ADBMediaSettings

public class ADBMediaSettings : NSObject{ public virtual string Channel { get; set; }

public override IntPtr ClassHandle { get; }

public virtual nuint CompleteCloseOffsetThreshold { get;

33iOS

Page 34: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

set; }

public virtual string CPM { get; set; }

public virtual bool IsMediaAd { get; set; }

public virtual double Length { get; set; }

public virtual string Milestones { get; set; }

public virtual string Name { get; set; }

public virtual string OffsetMilestones { get; set; }

public virtual string ParentName { get;

set; }

public virtual string ParentPod { get; set; }

public virtual double ParentPodPosition { get; set; }

public virtual string PlayerID { get; set; }

public virtual string PlayerName { get; set; }

public virtual bool SegmentByMilestones { get; set; }

public virtual bool SegmentByOffsetMilestones { get; set; }

34iOS

Page 35: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

public virtual nuint TrackSeconds { get; set; }

public ADBMediaSettings ();}

Constants

public static class Constants{ public static NSString ADBConfigKeyCallbackDeepLink { get; }

public static NSString ADBTargetParameterCategoryId { get; }

public static NSString ADBTargetParameterMbox3rdPartyId { get; }

public static NSString ADBTargetParameterMboxHost { get; }

public static NSString ADBTargetParameterMboxPageValue { get; }

public static NSString ADBTargetParameterMboxPc { get; }

public static NSString ADBTargetParameterMboxSessionId { get; }

public static NSString ADBTargetParameterOrderId { get; }

public static NSString ADBTargetParameterOrderTotal { get; }

public static NSString ADBTargetParameterProductPurchasedId { get; }}

Enumerations

ADBMobileVisitorAuthenticationState

public enum ADBMobileVisitorAuthenticationState : ulong{ Unknown, Authenticated, LoggedOut}

ADBMobilePrivacyStatus

public enum ADBMobilePrivacyStatus : ulong{ OptIn = 1uL,

35iOS

Page 36: Adobe Marketing Cloud Xamarin Components for · PDF fileXamarin Components for Marketing Cloud Solutions 4.x SDK This topic describes how to get started using Xamarin components for

OptOut, Unknown}

ADBMobileDataEvent

public enum ADBMobileDataEvent : ulong{ Lifecycle, AcquisitionInstall, AcquisitionLaunch, DeepLink}

ADBMobileAppExtensionType

public enum ADBMobileAppExtensionType : ulong{ Regular, StandAlone}

36iOS