Email Us

Getting Started

Learn how to configure your project and start using Point SDK

Setting Up Point SDK

Before any feature can be used, you must initialize the SDK by providing your credentials. It is recommended to do this at the start of your application.

class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        Point.verbose = true // if want to see console logs about the SDK operations
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET",
            environment: .development

⚠️ Using Point.verbose = true will make the SDK print logs in the debug console about internal operations, filters, dates, errors, warnings and much more. This is helpful during development/integration phase, but we recommend turning it off before releasing your app into production.

Setting a User Token

A user token is necessary to use any of the SDK features, as it's used to identify and authenticate your user against Point API. The easiest method of handling authentication is setting a refresh token, which will allow Point SDK to automatically handle everything for you, including creating an Access Token and refreshing it when needed, automatically.

⚠️ If you have set up Healthkit integration, the setUserToken function automatically trigger a group of queries fetching past user's data, only if it's the first setUserToken usage in the current session. Because of this, we suggest evoking this function after HealthKitManager/requestAuthorizationsIfPossible() otherwise this automatic sync will fail. Refer to Point Health Kit for more information.

Set a Refresh Token

📝 This section assumes you already have a refresh token. Refer to Registering Users for more details.

Use Point/setRefreshToken(refreshToken:for:shouldSyncHistoricalData:) to set the user's refresh token.

func loginWithRefreshToken(refreshToken: String, userId: String) async throws {
    try await Point.setRefreshToken(refreshToken: refreshToken, for: userId)

When you set the refresh token, the SDK will get a valid access token internally and will handle its expiration automatically, this way you won't need to handle the access token by yourself. If the SDK fails to get an access token with the given refresh token and exception will be thrown.

💡 You just need to call this function once, when you login your user, as the SDK stores the token and is able to user it even if the user closes your app.

Set Access Token manually

📝 This section assumes you already have an access token. Refer to Registering Users for more details.

You can also manually handle your Access Token. Call Point/setAccessToken(accessToken:shouldSyncHistoricalData:) to set an access token. Note that you will need to call this function every time the access token expires (tipically in 24 hours).

func setupAccessToken(accessToken: String) async throws {
    try await Point.setAccessToken(accessToken: accessToken)

⚠️ You don't need to call this function if you have already set a Refresh Token.

Collecting and uploading samples

Use one or more of our integrations to collect and upload health samples and basic user data to Point Database.

  • Check HealthKit Integration to know how to support Apple Watch and Health app. This is only available in iPhone devices.

  • Check Fitbit Integration to know how to support Fitbit devices. This is available regardless of device.

Retrieving user data and generated metrics

Use the Point Health Data Service to retrieve user data and generated metrics such as recommendations, trends, workouts, health metrics and more.

Next Steps

Learn more about the Health Kit integration.

Connect with Us

Terms & Conditions | Privacy Policy © 2023 Point® (Key Point Technologies, Inc.)