Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Of all the tyrannies that affect mankind, tyranny in religion is the worst." -- Thomas Paine


devel / alt.msdos.batch / Windows shell scripting to run Android commands from the Windows 10 command line

SubjectAuthor
o Windows shell scripting to run Android commands from the Windows 10 command lineScott Lurndal

1
Windows shell scripting to run Android commands from the Windows 10 command line

<sinpgb$olu$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=105&group=alt.msdos.batch#105

  copy link   Newsgroups: alt.comp.os.windows-10 alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!sna/Zv3esfu7AR9/M2x1QQ.user.46.165.242.75.POSTED!not-for-mail
From: scott@slp53.sl.home (Scott Lurndal)
Newsgroups: alt.comp.os.windows-10,alt.msdos.batch
Subject: Windows shell scripting to run Android commands from the Windows 10 command line
Date: Sat, 25 Sep 2021 21:24:20 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <sinpgb$olu$1@gioia.aioe.org>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="25278"; posting-host="sna/Zv3esfu7AR9/M2x1QQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-newsreader: xrn 9.03-beta-14-64bit
X-Notice: Filtered by postfilter v. 0.9.2
 by: Scott Lurndal - Sat, 25 Sep 2021 18:24 UTC

Does anyone know the command line command that I can put in a batch file to
allow that Windows adb script to open a specific unique settings page on
Android (aka, an "Activity"), and then to press a button on that page?

There are probably hundreds of Android pages inside of Android applications
that we might want to interact with from Windows so let's just try one.

A simple example is the "reset advertising id" Android settings page.
<https://www.ghacks.net/2015/04/20/how-to-reset-your-advertising-id-on-android/>

While the ultimate goal is to be able to reset the Android Advertising ID
automatically (e.g., every time the phone is connected to Windows over USB
or Wi-Fi), the baby steps are to manually reset the Advertising ID on
Android but doing that from the Windows command line whenever you want to.

I'm almost there... as I can bring up the "Reset Advertising ID" Activity
from a Windows 10 command line, but I can't yet _press_ the "reset" button!

Does anyone know how to _press_ that reset button from a Windows script?
--
This is the method I used on Windows to bring up the reset adid Activity.
[Note that I am not rooted and that I'm using Windows 10 & Android 11.]

1. Install & test adb on Windows as per instructions here.
<https://www.xda-developers.com/install-adb-windows-macos-linux/>
<https://dl.google.com/android/repository/platform-tools_r31.0.3-windows.zip>

2. Connect your phone & run a quick test that you have a connection.
C:\> adb pull /system/etc/hosts .\hosts.txt
[That should copy the Android hosts file over to your Windows machine.]

Find the number of packages you have which have "google" in the name.
C:\> adb shell pm list packages google | find /c /v ""

3. Now bring up the gms "Reset AD ID" Activity on Android from Windows:
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
That should pop up the "Reset AD ID" settings page on your phone.
[GMS is a set of "google mobile services" products native on Android.]

You can close that page on Android from Windows by running this:
C:\> adb shell am force-stop com.google.android.gms
Which you can put into a "closegms.bat" one-line file for convenience.

The missing next step is how to _press_ that "Reset" button on the Activity?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor