Android Core Library for the Customer App | Zoho Creator Help

Android core library

Notes
This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version.

Install the Android core library for the customer app

The core library of Zoho Creator's Android SDK allows you to create custom UI and build an Android app using the data present in your Creator application.

Prerequisites

  • The latest version of Android Studio

Register your Android app with Zoho

  1. Navigate to the DEPLOY section on the left pane of the admin dashboard and click Mobile to open its configuration page.
  2. Click the SDK tab and select the required application with User Type as For Customer for which you want to configure the core framework.
  3. Click Create Client in the For Customer - SDK configuration pane to create a dedicated token storage entity for an application instance. A popup to configure client details appears.
  4. Fill out a custom Client name and Redirect URI in the respective input fields of the popup. The redirect URI is an application specific unique identifier, used to redirect the user from the browser back to the mobile application after successful authentication. The same URI should be configured in the authentication server.
    Notes
    Note: The redirect URI must be specified in the format, <anyvalue>://
  5. Tick the Generate JWT Secret checkbox to generate a secret key that can be used as an input to the JWT builder for generating JWT tokens while installing the core framework.
  6. Click Create to proceed.
    Notes
    Note: Generating a JWT secret configures the client exclusively for JWT-based authentication. After the JWT secret is generated, access and refresh tokens can only be requested using "with JWT token" method.
    This will generate the client ID, client secret, and portal ID for the iOS app that you want to integrate with your Creator application. The JWT secret will also be displayed, if the Generate JWT Secret checkbox was selected. Once a client is created, the + Create Client option, allowing you to create additional clients for the same application.
  7. Downloaded the zcapp_info.properties file, then add it to your project's raw folder: "<your_project_folder>/app/src/main/res/raw". (Create a folder named raw in this location if it doesn't exist)

1.1.  Managing clients

The below actions can be performed for a client in the For Customer - SDK   configuration pane:
  1. Create multiple clients: Click +Create Client to add additional clients and generate respective credentials for the Zoho Creator portal application.
  2. View client details: Click the horizontal ellipsis (  ) icon next to a client and select View client details.

    The Client ID, Client Secret, and JWT Secret for the selected client are displayed.

  3. Regenerate JWT secret:

    1. Click the horizontal ellipsis (  ) icon next to a client and select View client details.
    2. Click Regenerate under Client Details to generate a new JWT Secret if the existing secret needs to be refreshed for security purposes.
    3. Click Done to save the changes.

  4. Edit redirect URI:

    1. Click the horizontal ellipsis (  ) icon next to a client and select Edit redirect URI.
    2. Enter the new redirect URI and click Update to save the changes.

  5. Delete a client: Click the horizontal ellipsis (  ) icon next to a client and select Delete to remove a client. The generated client ID and its authentication credentials will also be removed.

2. Kotlin

Notes
Note: The Android app must have a minimum SDK version 22 or higher.
  1. Integrate SDK with your Android app:
    1. Add the Zoho maven repository URL in app/build.gradle:
      allprojects {
            repositories {
                  google()
                  mavenCentral()
                  maven {
                             url 'https://maven.zohodl.com'
                  }
            }
      }
      Notes
      Note: While adding the repository URLs in build.gradle you may encounter Build was configured to prefer settings repositories over project repositories issue. To proceed further, you need to add the repository URLs in settings.grade.
    2. Integrate Zoho Creator Core Library & Authentication Library in app/build.gradle:
      dependencies {
           implementation 'com.zoho.creator:creator-core:1.6.0'
           implementation 'com.zoho.accounts.android:zaccountsclientportalsdk:V2_0'
      }
    3. Click Sync Now in the bar that appears in the IDE.
  2. Configure your project with the following code:
    1. Add the below string in the strings.xml of your app:
      <string name="iam_portal_url">https://accounts.zohoportal.com</string> <!--enter the accounts URL of your respective DC. For eg: EU users use https://accounts.zohoportal.eu-->
      <string name="c_id"> GENERATED CLIENT ID </string>
      <string name="c_secret"> GENERATED CLIENT SECRET ID </string>
      <string name="c_portal"> PORTAL ID </string>
      <string name="redir_url"> REGISTERED REDIRECT URI</string>
    2. In the oncreate method in your application / activity class, Initialize the Accounts SDK as follows:
      IAMClientSDK.getInstance(this).init(scopes)
      where scopes - "aaaserver.profile.READ,zohocontacts.userphoto.READ,ZohoContacts.contactapi.READ,
      ZohoCreator.meta.CREATE,ZohoCreator.meta.READ,ZohoCreator.meta.UPDATE,
      ZohoCreator.meta.DELETE,ZohoCreator.data.CREATE,ZohoCreator.data.READ,
      ZohoCreator.data.UPDATE,ZohoCreator.data.DELETE,ZohoCRM.modules.READ,
      ZohoCRM.users.READ"
      Notes
      Note: The scope list have been updated for version 1.4 and above.
    3. Create an Activity called HandleRedirectActivity and add the following code to its oncreate method:
      IAMClientSDK.getInstance(this).handleRedirection(this)
    4. Add the following code to the AndroidManifest.xml file:
      <activity android:name=".HandleRedirectActivity" android:exported="true">
      <intent-filter>
           <action android:name="android.intent.action.VIEW" />
           <category android:name="android.intent.category.DEFAULT" />
           <category android:name="android.intent.category.BROWSABLE" />
           <data android:scheme="<REDIRECT_URI_WITHOUT_COLON_AND_SLASH>" />
      </intent-filter>
      </activity>
    5. To open the login screen, add the below code snippet:

      If you enabled Generate JWT token while creating the client, add the code snippet in the With JWT token tab. Otherwise, add the code in the Without JWT token tab.
      Without JWT token
      With JWT token
      Without JWT token
      val sdk = IAMClientSDK.getInstance(applicationContext)
      if (!sdk.isUserSignedIn) {
      sdk.presentLoginScreen(this, object : IAMTokenCallback {
      override fun onTokenFetchInitiated() {

      }

      override fun onTokenFetchComplete(zohoToken: IAMToken) {
      //<This method will be called after user logged-in successfully>
      }

      override fun onTokenFetchFailed(zohoErrorCodes: IAMErrorCodes) {
      //<This method will be called if any error occurred in the login. You will receive the error code in this callback.>
      }
      }, null)
      } else {
      // start intent to your first activity
      }
      With JWT token
      val sdk = IAMClientSDK.getInstance(applicationContext)
      if (!sdk.isUserSignedIn) {
      IAMClientSDK.getInstance(context).getRemoteTokenWithJWTToken(jwtToken, <PORTAL ID>, object : IAMTokenCallback {
      override fun onTokenFetchInitiated() {

      }

      override fun onTokenFetchComplete(token: IAMToken) {

      }

      override fun onTokenFetchFailed(errorCode: IAMErrorCodes) {
      if (errorCode == IAMErrorCodes.user_cancelled) {
      return
      }
      //This method will be called if any error occurred in the login. You will receive the error code in this callback.
      }
      })
      } else {
      // start intent to your first activity
      }
    6. Implement the Creator Authentication interface ZCOauthHelper as follows:
      class ZCAuthImpl(private val context: Context) : ZCOauthHelper {

      @Throws(ZCException::class)
      override suspend fun getAccessToken(): String? {
      return suspendCoroutine { continuation ->
      IAMClientSDK.getInstance(context).getToken(object : IAMTokenCallback {
      override fun onTokenFetchInitiated() {
      }

      override fun onTokenFetchComplete(token: IAMToken) {
      continuation.resumeWith(Result.success(token.token))
      }

      override fun onTokenFetchFailed(errorCode: IAMErrorCodes) {
      continuation.resumeWith(Result.success(null))
      }
      })
      }
      }

      override fun getInitialScopes(context: Context): String {
      return ""
      }

      override fun isUserSignedIn(): Boolean {
      return IAMClientSDK.getInstance(context).isUserSignedIn
      }

      override fun getUserData(): Any? {
      return null
      }

      override fun getTransformedUrl(url: String): String {
      return url
      }

      override fun checkAndLogout(): Boolean {
      return false
      }

      override fun isEnhanceTokenNeeded(newScopes: String): Boolean {
      return false
      }

      override fun enhanceToken(tokenHelper: ZCOauthHelper.ZCOAuthTokenHelper, newScopes: String) {
      }

      override fun enhanceTokenWithOnDemandScope(tokenHelper: ZCOauthHelper.ZCOAuthTokenHelper) {
      }
      }
    7. Add the below code snippet to your application's / activity's oncreate method to set the instance of Authentication interface to the Creator SDK:
      ZCAPIUtil.setOAuthHelper(ZCAuthImpl(applicationContext))
    8. Initialize the ZohoCreator SDK in your application's / activity's oncreate method:
      ZCAPIUtil.initialize(applicationContext)

FAQ

  1. I'm getting merge conflicts while generating a build. How to resolve them?
    Please add tools:replace="android:allowBackup" under the application tag in the AndroidManifest.xml file and try again.
  2. I get the "Duplicate class android.support.v4.app" error. What should I do?
    To resolve this error, you'll need to add android.enableJetifier=true in gradle.properties file
  3. I get the "Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified" error. What should I do?
    To resolve this error, please add implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0' to your dependency list

References


        Create. Review. Publish.

        Write, edit, collaborate on, and publish documents to different content management platforms.

        Get Started Now


          Access your files securely from anywhere

            Zoho CRM Training Programs

            Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

            Zoho CRM Training
              Redefine the way you work
              with Zoho Workplace

                Zoho DataPrep Personalized Demo

                If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

                Zoho CRM Training

                  Create, share, and deliver

                  beautiful slides from anywhere.

                  Get Started Now


                    Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                    BOOK A SESSION







                                Quick LinksWorkflow AutomationData Collection
                                Web FormsEnterpriseOnline Data Collection Tool
                                Embeddable FormsBankingBegin Data Collection
                                Interactive FormsWorkplaceData Collection App
                                CRM FormsCustomer ServiceAccessible Forms
                                Digital FormsMarketingForms for Small Business
                                HTML FormsEducationForms for Enterprise
                                Contact FormsE-commerceForms for any business
                                Lead Generation FormsHealthcareForms for Startups
                                Wordpress FormsCustomer onboardingForms for Small Business
                                No Code FormsConstructionRSVP tool for holidays
                                Free FormsTravelFeatures for Order Forms
                                Prefill FormsNon-Profit

                                Intake FormsLegal
                                Mobile App
                                Form DesignerHR
                                Mobile Forms
                                Card FormsFoodOffline Forms
                                Assign FormsPhotographyMobile Forms Features
                                Translate FormsReal EstateKiosk in Mobile Forms
                                Electronic Forms
                                Drag & drop form builder

                                Notification Emails for FormsAlternativesSecurity & Compliance
                                Holiday FormsGoogle Forms alternative GDPR
                                Form to PDFJotform alternativeHIPAA Forms
                                Email FormsFormstack alternativeEncrypted Forms

                                Wufoo alternativeSecure Forms

                                TypeformWCAG

                                  Zoho FSM Video Tutorials


                                        All-in-one knowledge management and training platform for your employees and customers.

                                                  Create. Review. Publish.

                                                  Write, edit, collaborate on, and publish documents to different content management platforms.

                                                  Get Started Now




                                                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                        Manage your brands on social media


                                                                          • Desk Community Learning Series


                                                                          • Digest


                                                                          • Functions


                                                                          • Meetups


                                                                          • Kbase


                                                                          • Resources


                                                                          • Glossary


                                                                          • Desk Marketplace


                                                                          • MVP Corner


                                                                          • Word of the Day


                                                                          • Ask the Experts


                                                                            Zoho Sheet Resources

                                                                             

                                                                                Zoho Forms Resources


                                                                                  Secure your business
                                                                                  communication with Zoho Mail


                                                                                  Mail on the move with
                                                                                  Zoho Mail mobile application

                                                                                    Stay on top of your schedule
                                                                                    at all times


                                                                                    Carry your calendar with you
                                                                                    Anytime, anywhere




                                                                                          Zoho Sign Resources

                                                                                            Sign, Paperless!

                                                                                            Sign and send business documents on the go!

                                                                                            Get Started Now




                                                                                                    Zoho TeamInbox Resources





                                                                                                              Zoho DataPrep Demo

                                                                                                              Get a personalized demo or POC

                                                                                                              REGISTER NOW


                                                                                                                Design. Discuss. Deliver.

                                                                                                                Create visually engaging stories with Zoho Show.

                                                                                                                Get Started Now








                                                                                                                                    • Related Articles

                                                                                                                                    • Android core library

                                                                                                                                      This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. The core library of Zoho Creator's Android SDK allows you to create custom UI and build an Android app using the data ...
                                                                                                                                    • Android UI library

                                                                                                                                      This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. The Android UI library helps you use the UI components of the modules and also to design your own custom UIs. Prerequisites ...
                                                                                                                                    • Android SDK

                                                                                                                                      This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. Mobile Software Development Kits (mobile SDK) provide a set of software development tools that allow for a wide range of ...
                                                                                                                                    • Configure push notifications for your Android app

                                                                                                                                      This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. Note: Firebase Cloud Messaging server key has been deprecated on June 21, 2024. To continue using push notifications, update ...
                                                                                                                                    • Android UI library

                                                                                                                                      This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. Install the Android UI library for the customer app The Android UI library helps you use the UI components of the modules ...
                                                                                                                                      Wherever you are is as good as
                                                                                                                                      your workplace

                                                                                                                                        Resources

                                                                                                                                        Videos

                                                                                                                                        Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                        eBooks

                                                                                                                                        Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                        Webinars

                                                                                                                                        Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                        CRM Tips

                                                                                                                                        Make the most of Zoho CRM with these useful tips.



                                                                                                                                          Zoho Show Resources