How to add the SonarPen support to Krita in a few steps, so pen pressure can be detected

An user deleted a few earlier topics, and the information on the topics was lost. Here I am consolidating the info and repost it here for the developer @halla and other members that may be interested in using budget friendly SonarPen on their Android tablets that has no stylus built-in.

Original topics discussed why SonarPen only focus in a group of apps on Android but doesn’t support Krita

Here is the updated reply:

Short answer:
To add SonarPen support to Krita

  1. email to elton.leung@greenbulb.com, ask for SonarPen driver (SDK)
  2. Download the free SonarPen Android SDK, extract the content to a folder
  3. Add the 54KB aar file from the folder to the programming project (Krita)
  4. Add a few lines of code:

enable the driver
SonarPenUtilities sonarpenutilities = new SonarPenUtilities(context);

view Attach (tell driver where to draw onto)
sonarpenutilties.addSonarPenToView(view)

start using SonarPen
sonarpenutilities.start()

end using SonarPen
sonarpenutilites.stop()

  1. Compile the project into Krita app.

Longer answer:
I am Elton, the inventor of the SonarPen. I love to have the SonarPen works on all platforms and runs with all apps that requires a stylus.

Android OS has a standard stylus API (function calls) for apps to receive the status of the stylus (X, Y, buttons… etc). When @halla said in a earlier post

if it (a stylus) uses the default Android pen API, then it should work out of the box …

She actually means if the driver of a stylus provides the status of the stylus through the use of default Android pen API, then it should work with all apps out of the box.

The fact is SonarPen driver uses the default Android pen API, and you may think it be must compatible with all Android apps.

Unfortunatly, for a stylus pen to be compatible with ALL Android apps, it can either be a bundled stylus, like Samsung S-Pen, where the S-Pen stylus driver is included in the Android OS during manufacturing. Or a pen tablet, like the ones from Wacom which is hardware compatbile with the generic USB tablet driver that was included in Android by Google. A driver is always needed to provide the stylus’ status to the apps through the pen API. For both S-Pen and Wacom’s tablets, the drivers are preloaded by the manufacturer onto devices.

Unlike Windows or MacOS, Android OS and iOS are close system. Driver can’t be installed by the user. Which means I can’t create a downloadable SonarPen driver for your device. For Krita to recognize SonarPen as a stylus, Krita’s developer needs to add the SonarPen driver into the Krita’s code, add a few lines of code to enable SonarPen driver and then compile everything into an app. The SonarPen driver is downloaded onto your device with Krita. When SonarPen driver is enabled in Krita, the app will be able to work with the SonarPen as they can communicate through the default Android pen API. It is the decision of the app developer to support a stylus but not the other way around.

I have proposed to Krita Android developer to add the SonarPen support a few years ago. Many changes have been made on our side to make using SonarPen much easier, and now I strongly urge the developer to reconsider.

Here are the benefit:

  1. The SonarPen drvier (SDK) is super easy to integrate to drawing app, because it uses the default Android pen API. When it is enabled, Krita will be able to commicate with the SonarPen
  2. SonarPen SDK is very small in size. All we need is Krita to bundle an 54KB aar file in the app.
  3. We have created a free app, SonarPen Calibrate to take care of the calibration on Android devices, Krita developers don’t need to worry about calibration.
  4. SonarPen SDK is free to use, no royalty nor licensing fee.
  5. SonarPen SDK is updated constantly to provide the best compatibility to new OS update and new devices. SonarPen is compatibility with over 100 brands and over 1000 Android devices. Over 98% of the listed Android devices has no bundled stylus (like S-Pen) and SonarPen is an low cost alternative to enable fully enjoy stylus required app (like Krita)
  6. SonarPen samples will be sent to the developers free of charge to help testing and integration.

If you are still with me, thank you very much for your time. Please email directly and developer samples will be shipping out the next day.

Elton
elton.leung@greenbulb.com

6 Likes

It is still the case that this code should not be added to Krita. If the drivers cannot be installed because of Android restrictions, the code should be added to Qt: Krita simply does not have any dedicated tablet handling code.

4 Likes

Yes, I know what you mean. Let me see if I can ask my engineer to do a wrapper to our SDK that can be injected into Qt. Then we will show the result here.

Elton

5 Likes