I'm attempting to track the deactivation of notifications within android. This I planned on doing by polling the notification dumpsys every x seconds. There for I've put the notification into a variable so I can search the $tmp variable for a text (in this case google.gm) and based on this it will set the $Gmail on true or false.
When I tested my script-setup via Cygwin terminal on the PC it worked great, however not on Android
getting the dumpsys notification into $tmp works fine, but when I test it (in the shell) on android it seems to not want to accept my * wildcards.
tmp=$(dumpsys notification)
[[ "$tmp" == *"google.gm"* ]] && Gmail=true || Gmail=false
I've been searching the web for the last two hours, but It'd kinda driving me crazy. I've done simplified tests to debug it and it really seems to be in the wildcard character
Does anybody see what I'm doing wrong?
After the new suggestions I managed to make this out of it:
tmp=$(dumpsys notification)
case $tmp in *notify_missed_call*) PRF1="1" ;; *) PRF1="0" ;; esac
case $tmp in *conv_notify*) PRF2="1" ;; *) PRF2="0" ;; esac
case $tmp in *NotYetThere*) PRF3="1" ;; *) PRF3="0" ;; esac
case $tmp in *stat_notify_calendar*) PRF4="1" ;; *) PRF4="0" ;; esac
echo $PRF1,$PRF2,$PRF3,$PRF4, > /sdcard/tmp.txt
But somehow it only works when put in 1 line with ; between them. any way to make this work multiline (easier to maintain) and optimize it?
thanks