AutoExit app/script for Android/Aliendalvik

Hi, i am writing on an app that shuts down automatically the android support when no android app is running on Sailfish OS. I thought all android apps have an “android” string in the process name but this adoption was wrong. the script should work relative simple :

CheckInterval=300s
AndroidDefaultProcesses="com.android.systemui com.android.phone android.ext.services ..."
ExcludedApps="App1 App2 ...."

for i in $(pgrep -a android | cut -d " " -f2 ); do echo "$AndroidDefaultProcesses" | grep  "$i" || AndroidApp=active ;done
if [[ ! $AndroidApp == active ]]; then
	kill <PID_OF_Aliendalvik> or <aliendalvik shutdown/quit cmd) 
fi

“pgrep -a android” does not match for android apps cause the android apps do not have any android string in the processname. So i need a command to show all running android processes.