0

I want to create a React Native app using Expo Managed workflow (which I've done before) but this time it should listen and "record" all device keyboard input while the app is in the background (something I've never done before). I know there are other keyboard apps that request permission to listen to all device input but can't remember.

EDIT: as @Abe said I'm now thinking of making a custom keyboard trough which the input is processed (and then thrown await while stats are kept). Where do I start when making a custom keyboard for the device using RN Expo?

I have thought of using Expo BackgroundFetch but am stuck as I'm not sure how I would get the input despite being run in the background.

The reason is to create an app that gives the user a weekly summary of the amount of text that has been written along with other attributes regarding writing. I'm mainly making this for iOS but want to try make it for Android too if possible at the same time.

Any tips on how this can be achieved?

1 Answers1

0

I don't know of a cross-platform solution to this. I believe (and hope) that a third-party app cannot "listen" to all keyboard input - it would be far too easy to abuse. However, if you can get your users to use a custom keyboard, and make the data available to your app through that, that may do what you want.

If you do this, please take special care to ensure you are not storing typing data at all, or are doing so in an encrypted store. You will capture sensitive data and it's your responsibility to your users to keep that safe.

Here are the iOS docs on creating a keyboard:

https://developer.apple.com/documentation/uikit/keyboards_and_input/creating_a_custom_keyboard

And an Android tutorial (I have not followed it but it looks reasonable at a glance):

https://www.androidauthority.com/lets-build-custom-keyboard-android-832362/

Abe
  • 4,500
  • 2
  • 11
  • 25
  • okay I agree! But where should I start when making a custom device keyboard for RN using Expo? – William O'Brien Mar 23 '23 at 08:47
  • 1
    You will have to eject from Expo to use the custom native libraries you'll write. Expo is made for apps that don't need custom native code – Abe Mar 23 '23 at 15:19