SDK Configuration

Initialize our SDK once in the early stage of your application lifecycle

You can find your API key in your app Setting page in the Glassfy Dashboard, you can also copy it by clicking on the button to the left of the form.

Step 1Step 1

Step 1

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

  Glassfy.initialize(apiKey: "YOUR_API_KEY", watcherMode: false)

  [...]

  // optionally login your user
  Glassfy.login(user: "youruser")

}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [Glassfy initializeWithAPIKey:@"YOU_API_KEY" watcherMode:NO];

  [...]

  // optionally login your user
  [Glassfy loginUser:@"youruser" withCompletion:nil];
}
class App : Application() {
  override fun onCreate() {
    super.onCreate()

    Glassfy.initialize(this, "YOUR_API_KEY", false, null)
  }
}
public class App extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
    Glassfy.initialize(this, "YOUR_API_KEY", false, null);
  }
}
try {

  await Glassfy.initialize('YOU_API_KEY',watcherMode: false);

} catch (e) {
  // error
  [...]
}
try {

  await Glassfy.initialize('YOU_API_KEY', false);

} catch (e) {
  // initialization error
  [...]
}
try {

  await Glassfy.initialize('YOU_API_KEY', false);

} catch (e) {
  // initialization error
  [...]
}

Did this page help you?