Skip to main content

Getting Started Guide

Signup

Ionic Portals requires a product key to use. Getting a key is easy. Just head to the Ionic Dashboard and click "Get Access".

This will present you with a form asking for some additional information. After submitting the page will refresh and you will immediately see the key that can be used to unlock the use of Portals in your app.

info

You can always use this shareable link to signup for a Product Key: ionic.io/register-portals

Install

Ionic Portals is publicly available via Maven Central, Cocoapods, SPM, and NPM.

To add Portals to your Android project, add the dependency to your build.gradle files

build.gradle
// ----------------------------------------------
// Module-level build.gradle
// ----------------------------------------------
dependencies {
implementation 'io.ionic:portals:0.8.3'
}

And in the top level build.gradle file, be sure that you include jcenter and maven in your repositories section

// ----------------------------------------------
// Top-level build.gradle
// ----------------------------------------------
allprojects {
repositories {
google()

// Make sure JCenter and Maven Central are
// in your project repositories
jcenter()
mavenCentral()
}
}

To add Portals to your web project, install it via NPM:

npm install @ionic/[email protected]

If you need help configuring specific versions of Portals with Capacitor or Capacitor Plugins, check out our SDK Version Compatibility page.

Configure

After installing the dependency you need to register your copy of Ionic Portals at runtime. This works both offline and in production. You'll need to call PortalManager.register(myApiKey) before creating any Portals in your app. To get an API Key, refer to the Sign Up section.

Below is a simple example of how to bootstrap Ionic Portals before loading any Portal instances in your app. We recommend placing this register call inside the onCreate() function of a custom Application class so that it is handled immediately when your app is launched, but you can place it anywhere as long as it is called before your app tries to load any Portals.

import android.app.Application
import io.ionic.portals.PortalManager

class MyApplication : Application() {
override fun onCreate(): Unit {
super.onCreate()
PortalManager.register("YOUR_PORTALS_KEY")
// setup portals...
}}
}
warning

Avoid committing your Portals key to source code repositories where it may be publicly visible! On Android, you can use the Secrets Gradle Plugin to keep it out of a public repository.