Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrar el SDK D1 usando Ionic Capacitor

Overview

Capacitor is an open source native runtime for building Web Native apps. With Capacitor, you can create cross-platform iOS, Android, and Progressive Web Apps using JavaScript, HTML, and CSS.

Capacitor is an alternative to Cordova as the runtime environment when developing issuer applications using Ionic.

To integrate D1 SDK using Capacitor, refer to the following sections:

Capacitor Plugin

When integrating third party SDK's and native components, the Android and iOS native projects have to be placed in the respective modules called Plugins, which are then added to the Capacitor project.

Creating Cordova Plugin for D1 SDK

Prerequisites

This guide was tested with:

  • D1 SDK

    • 4.0.0 Android

    • 4.0.0 iOS

  • Ionic

    • Ionic CLI 6.20.8

    • Angular CLI 16.1.4

  • Capacitor

    • Capacitor CLI 5.2.1

    • Capacitor/android 5.2.1

    • Capacitor/core 5.2.1

    • Capacitor/ios 5.2.1

  • Xcode 14.3.1

To create a template for the Capacitor plugin:

Plugin compilation is done using the following command:

TypeScript interface

After the template is created, the TypeScript method prototypes will be called from the Capacitor project.

The following code snippets show how to create the method prototypes for the Login and Configure use cases.

Android platform

Implementing the Java native plugin entry point

For the TypeScript method prototypes:

  1. Create the appropriate entry point in the Android native code.

  2. To implement the native Android entry point of the plugin, extend the Capacitor Java class Plugin.

Android default CookieManager

Adding D1 SDK dependencies to the Capacitor plugin

Add the D1 SDK binaries dependencies.

  1. Create the Android modules using D1 SDK.

  1. Add the dependencies to the Capacitor plugin.

NFC Wallet Configuration Files

  1. Add the NFC Wallet configuration files to the Capacitor plugin.

iOS platform

Implement the Swift native plugin entry point

For the TypeScript method prototypes:

  1. Create the appropriate entry point in the iOS native code.

  2. To implement the Native iOS entry point of the plugin, extend the Capacitor Swift class CAPPlugin.

  1. Export the method prototypes to the Capacitor plugin.

Adding D1 SDK dependencies to the Capacitor plugin module

  1. The most simple way to differentiate between the Debug and Release version of D1 SDK on the iOS platform, is to wrap the D1 SDK binaries in to Pods.

Debug Podspec

Release Podspec

  1. Update the podspec file of the Capacitor plugin.

Integrating the Capacitor plugin to Ionic Capacitor application

Adding the D1 Capacitor plugin to your Capacitor project

  1. After all the updates are done, the Capacitor plugin needs to be built.

  1. Add the Capacitor plugin to the Capacitor project. Use the application ID com.thalesgroup.gemalto.d1.validation for the sandbox, when creating the Ionic Capacitor application.

  1. Add the Android and iOS platforms.

  1. Synchronize the Capacitor project with the respective platforms.

  1. Access the D1 Capacitor plugin API using TypeScript.

Updating the Capacitor Android application

The following updates are to be applied to the Android platform:

  1. Reference the new Android modules which contain the D1 SDK binaries in the Ionic Capacitor Android application.

  1. Update the minimum SDK version supported to 24.

  1. Set android:allowBackup to false.

  1. As NFC Wallet on the Android platform uses Firebase Cloud Messaging (FCM), Google Messaging Services has to be enabled in the Android application to use FCM.

    • Add FCM to Ionic application:

    • Add the google-services.json file to Android application.

  2. Update application signing keystore. To run the NFC Wallet use case on the Android platform, the application needs to be signed with a specific keystore.

Updating the Capacitor iOS application

  1. Add the Pods for D1 SDK Debug and Release version.

References

Última actualización

¿Te fue útil?