In our iOS and Android SDKs, you don't need to manage the datafile directly. These SDKs have an additional abstraction called a **manager** that handles getting the datafile and instantiating the client for you during the SDK's initialization process. The manager includes:
A built-in [User Profile Service](🔗) for storing variation assignments on the device.
A built-in [event dispatcher](🔗) for sending events in the background. It also retries sending using exponential backup if it fails.
Support for [datafile polling](🔗) to automatically update the datafile on a regular interval while the application is in the foreground.
The manager is implemented as a factory for Optimizely client instances. To use it:
Create a manager object by supplying your **SDK Key** and optional configuration settings for [datafile polling](🔗) and [datafile bundling](🔗). You can find the SDK key in the _Settings > Environments_ tab of a Full Stack project.
Note
Earlier versions of the SDK used a project ID rather than an SDK Key to create a manager. Project IDs are still supported in 2.x for backwards compatibility. If you supply a project ID, the SDK retrieves the **primary** environment's datafile. We recommend using SDK keys because they enable you to retrieve datafiles for other environments.
Choose whether to instantiate the client [synchronously or asynchronously](🔗) and use the appropriate `
initialize
` method to instantiate a client.
For full examples, see:
[Android example: `
_MainActivity.java
`](🔗)[Objective-C example: `
AppDelegate.m
`](🔗)[Swift example: `
AppDelegate.swift
`](🔗)
## Get a Client
Each manager retains a reference to its most recently initialized client. You can use the `getOptimizely
` function to return that instance.
If this method is called before any client objects have been initialized, a dummy client instance is created and returned. This dummy instance logs errors when any of its methods are used.