[Guide] Setting Up Push-To-Device For Camera Kit Sample Apps

ForumChris
ForumChris Posts: 23 👻
edited April 5 in General #1

Pre-Requisites

Setup the App ID and API Token for the sample apps using the values found in the apps page of the Camera Kit portal

Developer Portal Setup

The Redirect URIs and allowlisted usernames need to be set in the developer portal at kit.snapchat.com

Add Snapchat Usernames to Demo Users

Enable Login Kit

Select the Initial Version or version you are enabling Push-To-Device for, scroll down and select the Login Kit toggle to enable Login Kit for this integration

Add Redirect URI to Login Kit Section

Add <your-app-name>://snap-kit/oauth2 to the Redirect URI field within Login Kit, note that we will use myapp for the redirect URI for the remainder of this example:

Android Setup:

This assumes you have already set the gradle.properties values for api.token and application.id

Open the build.gradle file:

In manifestPlaceholders set the clientID:
snapKitClientId to the Public OAuth 2.0 Client ID in the Developer Portal:

Then set the snapKitRedirectUrl and following fields as:

            'snapKitRedirectUrl': 'myapp://snap-kit/oauth2',
            'snapKitScheme': 'myapp',
            'snapKitHost': 'snap-kit',
            'snapKitPath': '/oauth2',

iOS Setup

This assumes you have already set the SCCameraKitClientID and SCCameraKitAPIToken values in the Info Properties.

Set ClientID and RedirectURL

  1. Open the Info Properties tab:

  2. Set the provided Key: SCSDKRedirectUrl value as myapp://snap-kit/oauth2

  3. Set SCSDKClientId to the Public OAuth 2.0 Client ID in the Developer Portal:

  4. Scroll down to URL Types and change the URL Schemes to myapp or the name of the app you used for the redirectURL

Using Push-To-Device

  1. With the sample app deployed, press the Gear icon in the Android UI or the bottom UI element with the phone and arrow on iOS.
  2. You will be prompted to login to Snapchat and connect the auth to the Camera Kit app
  3. Once connected, Press the Scan Snapcode button in Lens Studio to pair with this app:
  4. You can then send future versions of the Lens from Lens Studio to the app via the drop down in the upper right of Lens Studio by selecting Send to Camera Kit

Comments

  • stevenxu
    stevenxu Posts: 584 👻

    @ForumChris Coming in clutch. Thanks Chris!!!

  • audun
    audun Posts: 302 🔥🔥🔥

    🙌🙌

  • kipp
    kipp Posts: 1

    @ForumChris, how would you test push-to-device CameraKit lenses using the Web SDK?

  • stevenxu
    stevenxu Posts: 584 👻
    edited May 2023 #5

    @kipp said:
    @ForumChris, how would you test push-to-device CameraKit lenses using the Web SDK?

    Thanks for posting on the forum! At the time of this writing, push-to-device is not ready for the Web SDK. You'll have to publish lens, add to lens folder, grab lens group id, and add to integration to test.

    But know that our eng team is cooking up a couple things for a more efficient process / better experience! Stay tuned... B)