#!/usr/bin/env bash

declare NUMBER
# Try read android id in system folder
NUMBER="$(sqlite3 /var/lib/waydroid/data/data/com.google.android.gsf/databases/gservices.db "select * from main where name='android_id';" | cut -f2 -d"|")"

if [[ -z "$NUMBER" ]]; then
	# If not found in system folder, try in user folder
	NUMBER="$(grep android_id "$1/.local/share/waydroid/data/data/com.google.android.gms/shared_prefs/Checkin.xml" | cut -f2 -d">" | cut -f1 -d"<")"
fi
echo "$NUMBER"
