To start working with Virtual Keyboard SDK, we first need to sync the required dependency, set required flags, and finally create an input service extending the KeyboardService class.
Let’s set up your Sample keyboard, which takes just a few minutes. Follow the instructions below to add the keyboard SDK to an existing application.
Add Fleksy SDK repositories to the settings.gradle
file.
|
|
Set android.enableJetifier
to true
in your gradle.properties
file:
android.enableJetifier=true
Edit the app’s module build.gradle
file, and add dependencies:
|
|
Ensure Java 1.8 (or higher) compatibility is enabled in the app’s module build.gradle
file:
|
|
Disable compression for json
and wav
files in your app’s module build.gradle
file:
|
|
Sync project with Gradle Files
to load the keyboard SDK dependencies.createConfiguration
to return a configuration as shown below.<your-license-key>
and <your-license-secret>
with your license.For example:
|
|
Create a new input-method file named sample_input_method.xml
in the res/xml
folder of your app’s module, and copy the following contents:
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:icon="@mipmap/ic_launcher"
android:isDefault="true">
<subtype
android:imeSubtypeExtraValue="EmojiCapable,AsciiCapable,TrySuppressingImeSwitcher"
android:imeSubtypeMode="keyboard"
android:label="%s"
android:overridesImplicitlyEnabledSubtype="true" />
<subtype
android:imeSubtypeExtraValue="AsciiCapable"
android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard"
android:isAsciiCapable="true" />
</input-method>
AndroidManifest.xml
file, as shown below.android:name
of the service to the class name that was created in step 6.For example:
|
|
Finally, download & copy the English language pack resourceArchive-en-US.jet to the assets/encrypted
folder of the main app module.
assets/encrypted
directory is absent by default on new projects unless created manually.
For example:
With a terminal open at the root of the android project, and with the provided language pack stored in the ~/Downloads
folder:
Create the encrypted
folder inside the assets
folder:
$ mkdir -p app/src/main/assets/encrypted
Copy the language pack to the assets/encrypted
folder:
$ cp ~/Downloads/resourceArchive-en-US.jet app/src/main/assets/encrypted
Your project is now ready to be built and run on a device of your choice.
Add ABI split to the app’s module build.gradle
file to build APKs with only the necessary dynamic libraries for each architecture. This reduces the APK size delivered to users.
|
|