Using ARDK User IDs

For features such as Lightship VPS, ARDK needs information associated with specific users of your AR experience. For example, with VPS, localization requests need to understand which user is scanning VPS activated locations at a given physical location.

To use these features, your AR experience should provide a User ID to ARDK, where the User ID is a unique value assigned to a given user of your app. Even if your game does not have VPS components, you should still provide a User ID if possible.

If you do not provide a User ID, ARDK will generate a Client ID and use this for requests (described in “Handling Scenarios Where No User ID Can Be Provided” below).

We strongly recommend generating and using User IDs. Accurate user information allows Niantic to support you in maintaining data privacy best practices and allows you to understand usage patterns of features among your users. Niantic also uses User IDs to help facilitate data requests made in accordance with GDPR (referred to throughout this page as “data management requests”).

User IDs and Client IDs may be considered personal information under privacy regulations. For more information about Lightship ARDK and privacy, please see Lightship ARDK Data Privacy FAQ.

Generating User IDs

ARDK has no strict format or length requirements for User IDs, although the User ID string must be a UTF8 string. We recommend avoiding using an ID that maps back directly to the user. So, for example, don’t use email addresses, or login IDs. Instead, you should generate a unique ID for each user. We recommend generating a GUID.

If your end user makes data management requests, you’ll need to be able to retrieve the User ID for that user, which you’ll then provide to Niantic as described in “End User Data Management Requests” below. How you retrieve the User ID will depend on your situation. Some example approaches are:

  • Securely store the User ID & user login in your cloud and provide a way for users to retrieve their User ID when they provide their login info.

  • Provide a way in your app for users to make data access requests, and use the generated User ID for the current app user.

  • Provide a secure web service that can generate the same User IDs for your user logins, using the same process you use in your app.

Note

The sample scenes in ARDK-Examples don’t generate or use User IDs (and instead use Client IDs as described in “Handling Scenarios Where No User ID Can Be Provided” below). We recommend not using ARDK-Examples scenes as templates for creating production apps. Instead you should make sure your app generates and uses User IDs if possible.

Using User IDs When Making API Requests

You’ll need to set the User ID whenever the active user of your app changes. For example, if your app is a multiplayer game that has a login feature, you’ll set the user ID when the user logs in and you’re starting or re-using a networked AR Session.

Call ArdkGlobalConfig.SetUserIdOnLogin() whenever the user logs in. You’ll provide a User ID that you’ve created as described in “Generating User IDs” above.

using Niantic.ARDK.Configuration;

// Set the user id associated with the current user.
ArdkGlobalConfig.SetUserIdOnLogin(your_generated_user_ID);

Once you’ve called SetUserIdOnLogin(), the User ID is set in a request envelope and will be automatically used for any subsequent ARDK requests that need the User ID.

Call ArdkGlobalConfig.ClearUserIdOnLogout() whenever the user logs out. This clears the User ID to ensure any subsequent ARDK requests don’t use the User ID of the logged-out user.

using Niantic.ARDK.Configuration;

// Clear the user id set by SetUserIdOnLogin.
ArdkGlobalConfig.ClearUserIdOnLogout();

If SetUserIdOnLogin() or ClearUserIdOnLogout() return False, there was an issue with device storage, or you may have used a non-UTF8 string for SetUserIdOnLogin(). Check that you have proper device storage permissions and that your userId string is UTF8, and then try the call again.

Handling Scenarios Where No User ID Can Be Provided

Niantic strongly recommends always providing a User ID, even if your app is only intended to be used by a single user at a time. However, you may encounter situations where it is not possible to generate or provide a User ID.

If you use ARDK features such as VPS and no User ID is provided in your requests, ARDK will use a randomized Client ID. The Client ID is generated the first time your app is run after being installed on the device and is deleted when the app is uninstalled. This generated client ID will be used in place of a User ID for ARDK requests. The Client ID should not be modified at run-time. In your app you can:

using Niantic.ARDK.Configuration;

// Returns the clientId - a unique identifier generated for the user/device
// in cases where a userId is not provided.
string clientID = ArdkGlobalConfig.GetClientId();
  • Provide the client ID to your user, which can then be used to make data management requests as described in “End User Data Management Requests” below.

Note that if your app is uninstalled, the client ID will be lost, so you’ll need to provide some way in your app for your users to get or use the Client ID if they make data management requests. How to do this will depend on the design of your app, but, for example, you could present the Client ID string, along with instructions or a web link to instructions on how to make data management requests, in your app.

End User Data Management Requests

For making data management requests on behalf of your user, you’ll need the following information:

  • The User ID, or Client ID if you’re not using User IDs

  • The Bundle ID/Package Name of your app

  • The type of request (GDPR Delete, GDPR Report, or both)

  • The lightship.dev Project name associated with your app

Provide this information in the following form: https://lightship.dev/account/settings?tab=Users

Niantic aims to complete all requests within 30 days. Niantic will send email notification to the email address registered with your lightship.dev developer account when the request has been completed.