Attention: You have to enable Internet (enabled by default in Windows 10) and Location (if needed) in Capabilities Tab of Package.appxmanifest for correct SDK's work.
To start working with the SDK, add the DevToDev.winmd and DevToDev.Background.winmd to the project references.
- Initialize the library at Application Launching event.
/** * <param name="appKey">App ID</param> * <param name="appSecret">Application secret key</param> */ DevToDev.SDK.Initialize(string appKey, string appSecret);
App ID and Secret key can be found in the application settings (Open "My apps" → App Name → "Settings" → "Integration").
If the application you integrate SDK in is a part of cross-platform project, then the user data initialization is required.
Since the analytics of cross-platform projects is based on an unique user (unlike the usual projects where it is based on device identifiers), you have to:
- Set the unique cross-platform user identifier (it will be used for cross-platform project data collection).
- Actualize the user data. Mostly it is about game applications where the player has a game level as a characteristic. For such projects you need to set the current player level.
We recommend you to set the user identifier before SDK initialization, otherwise the user identifier from the previous session will be used since the SDK initialization moment till the UserID field is set.
If your cross-platform application supposes to be used without cross-platform authorization, don't use the UserID field or use the empty string ("") as the user identifier. SDK will assign the unique identifier to user. This identifier will be used until the real cross-platform identifier assigns to the user.
DevToDev.SDK.UserID = "activeUserId"; //cross-platform user identifier (64 symbols max.) /** * <param name="appKey">App ID</param> * <param name="appSecret">Application secret key</param> */ DevToDev.SDK.Initialize(string appKey, string appSecret); /** * <param name="level">Current level</param> */ DevToDev.SDK.SetCurrentLevel(int level);
Attention! If your application allows user to relogin (changing the user during the working session of application), then the UserID field and SetCurrentLevel method should be called just after the authorization. You don't need to call the SDK initialization one more time.