Getting Started with Catalyst SDK for Android
Table of Contents:
The Catalyst SDK for Android is the easiest way to integrate your Android app with Catalyst. It enables accessing various Catalyst components in your Android app.
- Android studio (3.1.1 or later)
- Virtual device in AVD manager() (or) any physical Android device.
Before adding Catalyst SDK to your iOS app, you will need to create a Catalyst project.
- In the Catalyst Console, click Create New Project and enter a Project name in the pop-up window. Read and accept the terms and conditions, click Create.
- If you have an existing Catalyst project, you can access the same from the Catalyst home.
- Once your project has been created, click Access Project that redirects you to the home page of the project components.
After creating a Catalyst project, you can add your Android app to it.
- From your Catalyst project home, click Settings located in the top right corner.
- In the Settings Page, select Developer Tools.
- Click the Android option from the above screen which opens an Android SDK pop-up window.
- Provide the Package Name , Redirect URL and click Download.
Note: Redirect URL must be in lower case alphabets. Particularly, special characters and numbers are not allowed.
- This will download a sample android project with all the required Catalyst dependencies.
- Unpack the downloaded android project.
- Import the project in Android Studio selecting the Open an existing Android Studio project option.
- Select the unpacked android project and open.
Note: Catalyst SDK is added to your project by default.
To initialize Catalyst in your app,
- Open the MainActivity.java from your project.
- Paste the following code to Initialize Catalyst,
ZCProjectConfig projectConfig = ZCProjectConfig.newBuilder().setProjectId(PROJECT_ID).setProjectKey(“PROJECT_KEY”).build(); ZCProject.initProject(projectConfig);
- Enter the PROJECT_IDandPROJECT_KEYfrom your catalyst project. You can get your PROJECT_ID from General settings and ZAID (PROJECT_KEY) from Environments settings.
- When you are using Catalyst components in your app, define them asAsynchronous classes.
- All the catalyst components except the User Management APIs require Catalyst Authentication. Therefore it is mandatory to extend the Catalyst Base class in your Activity that will present the application Login/Logout where the authentication is achieved.