Not able to get android ids for multi user device setups (see: https://github.com/casualsnek/waydroid_script/pull/241) #242

Open
opened 2025-07-28 23:38:44 -04:00 by SoulInfernoDE · 0 comments
SoulInfernoDE commented 2025-07-28 23:38:44 -04:00 (Migrated from github.com)

Hello @casualsnek ,
i really like your collection and i added / changed the android_id stuff functionality to help with multi device setups beeing able to use/register the play store on any profile used on the same installation.

see:
https://github.com/casualsnek/waydroid_script/pull/241

and:
https://github.com/casualsnek/waydroid_script/pull/241/commits/73c746fe2b2b24c9b361956bdbe0cd119601d298

Image

Feel free to add it to your likings.

Have a nice day

with best regards
SoulInfernoDE

waydroid_script/stuff/android_id.py

from tools import container
from tools.helper import shell
from tools.logger import Logger
import re

class AndroidId:
    def get_id(self):
        if not container.is_running():
            Logger.error("Please make sure Waydroid is running and Gapps has been installed!")
            return

        try:
            # Get list of user IDs and their names using 'pm list users'
            users_raw = shell(
                arg="pm list users",
                env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n"
            )
            user_map = {}
            for line in users_raw.strip().splitlines():
                match = re.search(r'UserInfo\{(\d+):([^:}]+)', line)
                if match:
                    user_id, username = match.groups()
                    user_map[user_id] = username
        except Exception as e:
            Logger.error(f"Failed to parse user list: {e}")
            return

        print("------------------------------------------------------------------------")
        print(f"{'Username':<20} | {'User ID':^10} | {'GSF Android ID'}")
        print("------------------------------------------------------------------------")

        for user_id, username in user_map.items():
            try:
                db_path = f"/data/user/{user_id}/com.google.android.gsf/databases/gservices.db"
                query = f"sqlite3 {db_path} \"select value from main where name = 'android_id';\""
                gsf_id = shell(
                    arg=query,
                    env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n"
                ).strip()

                if gsf_id:
                    print(f"{username:<20} | {user_id:^10} | {gsf_id}")
                else:
                    print(f"{username:<20} | {user_id:^10} | (not found)")
            except:
                print(f"{username:<20} | {user_id:^10} | (query error)")

        print("------------------------------------------------------------------------")
        print("   ^----- Open https://google.com/android/uncertified/?pli=1")
        print("          Login with your Google ID, then submit the form with the ID(s) shown above.")

Hello @casualsnek , i really like your collection and i added / changed the android_id stuff functionality to help with multi device setups beeing able to use/register the play store on any profile used on the same installation. see: https://github.com/casualsnek/waydroid_script/pull/241 and: https://github.com/casualsnek/waydroid_script/pull/241/commits/73c746fe2b2b24c9b361956bdbe0cd119601d298 <img width="1084" height="583" alt="Image" src="https://github.com/user-attachments/assets/3129d6aa-aa3f-4175-8bef-e60b7a3f2960" /> Feel free to add it to your likings. Have a nice day with best regards SoulInfernoDE <details> <b><summary>waydroid_script/stuff/android_id.py</b></summary> ``` from tools import container from tools.helper import shell from tools.logger import Logger import re class AndroidId: def get_id(self): if not container.is_running(): Logger.error("Please make sure Waydroid is running and Gapps has been installed!") return try: # Get list of user IDs and their names using 'pm list users' users_raw = shell( arg="pm list users", env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n" ) user_map = {} for line in users_raw.strip().splitlines(): match = re.search(r'UserInfo\{(\d+):([^:}]+)', line) if match: user_id, username = match.groups() user_map[user_id] = username except Exception as e: Logger.error(f"Failed to parse user list: {e}") return print("------------------------------------------------------------------------") print(f"{'Username':<20} | {'User ID':^10} | {'GSF Android ID'}") print("------------------------------------------------------------------------") for user_id, username in user_map.items(): try: db_path = f"/data/user/{user_id}/com.google.android.gsf/databases/gservices.db" query = f"sqlite3 {db_path} \"select value from main where name = 'android_id';\"" gsf_id = shell( arg=query, env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n" ).strip() if gsf_id: print(f"{username:<20} | {user_id:^10} | {gsf_id}") else: print(f"{username:<20} | {user_id:^10} | (not found)") except: print(f"{username:<20} | {user_id:^10} | (query error)") print("------------------------------------------------------------------------") print(" ^----- Open https://google.com/android/uncertified/?pli=1") print(" Login with your Google ID, then submit the form with the ID(s) shown above.") ``` </details>
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wbruno/waydroid_script#242