Kotlin implementation

Example Android app


  1. If you don't already have Android Studio (free app from Google to build Android apps), download it here.
  2. Download the Sample App Folder: Sample Android App - Google Drive link
  3. Open the Sample App Folder in Android Studio.
  4. Run the app.
    1. Click Tools --> Device Manager --> Create Virtual Device. Try Pixel 9 or similar.
    2. Click the green arrow "Run app" button on the top toolbar.
    3. You will see the Acme Inc widget in the App Preview, as seen in the preview video above.
  5. Embed your widget in the app.
    1. In the MainActivity file, locate the EmbeddedLinkConfig setup on line 29.
    2. Replace publicAlias with your link's public alias. Find your link's public alias from the Links page. If you know your Canopy Connect link URL, it's the fragment after /c/. For example, the publicAlias of https://app.usecanopy.com/c/demo is demo.
    3. Optionally use consentToken if you're using your own custom consent screen & collecting consent in your app. It allows you to bypass our default consent screen, and end users can proceed directly to carrier selection.
    4. Optionally use pullMetaData to associate Pulls with your app's end users. pullMetadata is returned in the GET /pulls/:pullId API endpoint

Part to edit:

... lines 1 - 28 in MainActivity ...
val config = EmbeddedLinkConfig(
	publicAlias = "demo", // replace with your widget's public alias
  // Optional, use if you're collecting consent in your app and skipping our consent
  // screen. Replace with a consent token retrieved from our Consent API.
  consentToken = "xxx",
	// optional, custom metadata to associate Pulls with your app's end users. pullMetadata is returned 	in the Pulls API.
  pullMetaData = mapOf("custom-data-id" to "123-456"),
  hideCloseButton = true
),
... rest of MainActivity ...