User profile. devtodev SDK for Windows 10

Additionally to basic methods, you can observe and change the user profiles data. User profile is the set or properties describing the user. User properties can be divided into 4 groups:

  1. Crossplatform or custom user identifier. If this identifier is not set by developer, then the device identifier is used.
  2. Automatically collected properties, including data about user's device, geography, app version, SDK, and some other data which can be received from SDK.
  3. Default set of user properties, which can be set by developer. The set of this parameters works with separate methods. This set includes the data of user's name, sex, age, e-mail, phone-number and url of user picture. Also this set includes the mark of user as cheater.
  4. Custom set of user properties. In this case developer sets any user data he/she needs to know. The data is set in key-value format and can be numeric, string, array or boolean.

You can segment users by all the properties in My Apps section of an application.

 

Cross-platform user ID

This method is used for user initialization in the applications which are the parts of cross-platform project.

We recommend you to apply this method before the SDK initialization, otherwise the user identiticator from the previous session will be used since the SDK initialization moment till the UserID property call.

If your cross-platform application supposes to be used without cross-platform authorization, don't use the UserID property or use the empty string ("") as the user identifier. SDK will assign the unique identifier to user. This identifier will we used until the real cross-platform identifier assigns to the user.

Attention! If your application allows user to relogin (changing the user during the working session of application), then the UserID property should be called just after the authorization. You don't need to call the SDK initialization one more time.

/**
* Initializes the user with the specified cross-platform identifier
* property allows to get and to set unique cross-platform user ID used
* for user identification on your server.
*/
DevToDev.SDK.UserId = userId;

​This property also allows you to see which identifier is used at the moment.

 

Replace Cross-platform user ID

If it is possible to replace the user identifier in your application (say, to make changes in the login/user id for particular user), use this method at the moment of replacing the identifier.
Attention! Don't use this method if you're going to perform the user's relogin.

/**
* Replaces current cross-platform user id
* Attention! Don't use this method if you're going to perform the user's relogin.
* <param name="prevUserId">Old user identifier</param>
* <param name="userId">New user identifier</param>
*/
DevToDev.SDK.ReplaceUserId(string prevUserId, string userId);

 

Current user level

This method is used in cross-platform applications and applications with data synchronization. 

This method is required for user's level data initialization. We recommend you to use the SetCurrentLevel method just after the user initialization (using the UserID method).

Attention! Don't use the SetCurrentLevel method at the moment of user's level up. We recommend you to use the levelUp method in this case.

/**
* Initializes the current user level. Required if level feature used in the app.
* <param name="level">Сurrent game level of the player</param>
*/
DevToDev.SDK.SetCurrentLevel(int level);

 

Cheater

In case you have your own methods of determining cheaters in the application, you can have such users marked. Payments made by them will not be taken into account in the statistics.

/**
* Mark user if it's cheater.
* <param name="isCheater">true if user is a cheater</param>
*/
DevToDev.SDK.ActiveUser.SetCheater(boolean isCheater);

 

Name

User's name. Default user profile property.

/**
* Track user's name
* <param name="name">User’s name</param>
*/
DevToDev.SDK.ActiveUser.SetName(string name);

 

Age

User's age in years. Default user profile property.

/**
* Track user's age
* <param name="age">User’s age</param>
*/
DevToDev.SDK.ActiveUser.SetAge(int age);

 

Gender

User's gender. Default user profile property.

/**
* Track user's gender.
* <param name="gender">User’s gender. (Unknown, Male, Female)</param>
*/
DevToDev.SDK.ActiveUser.SetGender(DevToDev.Gender gender);

 

E-mail

User's e-mail. Default user profile property.

/**
* Track user's e-mail
* <param name="email">User’s e-mail</param>
*/
DevToDev.SDK.ActiveUser.SetEmail(string email);

 

Phone number

User's phone. Default user profile property.

/**
* Track user's phone number
* <param name="phoneNumber">User’s phone number</param>
*/
DevToDev.SDK.ActiveUser.SetPhone(string phoneNumber);

 

Photo

User's photo URL. Default user profile property.

/**
* Track user's photo URL
* <param name="photoUrl">User’s photo url</param>
*/
DevToDev.SDK.ActiveUser.SetPhoto(string photoUrl);

 

Custom user property

Set properties on the current user profile.

/**
 * Set properties on a user data.
 *
 * ### Usage:
 *     DevToDev.SDK.ActiveUser.SetUserData("Hair color", "copper red");
 *  properties can have string, int, double or List<object> type
 *
 * <param name="key">property name</param>
 * <param name="value">a value to set on the given property</param>
 */
DevToDev.SDK.ActiveUser.SetUserData(string key, object value);

/**
 * Set multiple properties at once
 *
 * ### Usage:
 *     Dictionary<string, object> userData = new Dictionary<string, object>();
 *     userData.Add("Hair color", "blonde");
 *	   userData.Add("Last payment", 100);
 *     List<object> lastOrder = List<object>();
 *     lastOrder.Add("Coloring");
 *     lastOrder.Add("Hair Straightening");
 *     userData.Add("Last order", lastOrder);
 *     DevToDev.SDK.ActiveUser.SetUserData(userData);
 *  properties can have string, int, double or List<object> type
 *
 * <param name="userData">an associative array of names and values</param>
 */
DevToDev.SDK.ActiveUser.SetUserData(Dictionary<string, object> userData);

 

Increment of the custom property

Increments the given numeric properties by the given values.

/**
 * Increments or decrements numeric user's properties.
 * ### Usage:
 *     DevToDev.SDK.ActiveUser.Increment("Rounds played", 1);
 *
 *     // to decrement a counter, pass a negative number
 *     DevToDev.SDK.ActiveUser.Increment("Rounds played", -1);
 *
 * <param name="key">property name</param>
 * <param name="value">an amount to increment the given property(int or double)</param>
 */
DevToDev.SDK.ActiveUser.Increment(string key, object value);

/**
 * Increments or decrements multiple numeric user's properties at once.
 *  ### Usage:
 *     Dictionary<string, object> data = new Dictionary<string, object>();
 *     data.Add("Rounds played", 1);
 *     data.Add("Enemies killed", 6);
 *     DevToDev.SDK.ActiveUser.Increment(data);
 *
 * <param name="values">an associative array of property names and numeric(int, double) values</param>
 */
DevToDev.SDK.ActiveUser.Increment(Dictionary<string, object>  values);

 

Append to custom property

Adds values to a list-valued property. If the property does not currently exist, it will be created with the given list as it's value. If the property exists and is not list-valued, the append will be ignored.

/**
* Append values to list properties.
* <param name="key">property name</param>
* <param name="value">appending value of type {string|int|double|List}</param>
*/
DevToDev.SDK.ActiveUser.Append(string key, object value);

/**
 * Multiple append list-valued properties at once
 * <param name="values">an associative array of property names and values</param>
 */
DevToDev.SDK.ActiveUser.Append(Dictionary<string, object> values);

 

Union with custom property

Adds values to a list-valued property only if they are not already present in the list. If the property does not currently exist, it will be created with the given list as it's value. If the property exists and is not list-valued, the union will be ignored.

/**
* Union a given list with a list-valued property, excluding duplicate values.
* <param name="key">property name</param>
* <param name="value">appending value of type {string|int|double|List}</param>
*/
DevToDev.SDK.ActiveUser.Union(string key, object value);

/**
 * Multiple union of a given lists with a list-valued properties at once
 * <param name="values">an associative array of property names and values</param>
 */
DevToDev.SDK.ActiveUser.Union(Dictionary<string, object> values);

 

Removing of the custom property

Removes a property or a list of properties and their values from the current user's profile.

/**
 * Removes property from user data.
 *
 * ### Usage:
 *     DevToDev.SDK.ActiveUser.UnsetUserData("Hair color");
 *
 * <param name="key">the name of the property</param>
 */
DevToDev.SDK.ActiveUser.UnsetUserData(string key);

/**
 * Removes multiple properties from user data at once.
 *
 * ### Usage:
 *     List<string> unsetData = new List<string>();
 *     unsetData.add("Hair color");
 *     unsetData.add("Last payment");
 *     DevToDev.SDK.ActiveUser.UnsetUserData(unsetData);
 *
 * <param name="keys">an array of property names</param>
 */
DevToDev.SDK.ActiveUser.UnsetUserData(List<string> keys);

 

Clearing of the all custom properties

/**
 * Removes all user's custom personal data from devtodev data base.
 */
DevToDev.SDK.ActiveUser.ClearUserData();

 

Basic Methods
Secondary Methods