Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

On the Internet, nobody knows you're a dog. -- Cartoon caption


computers / comp.mobile.android / Re: Termux am command to Android Settings Activity

SubjectAuthor
* Termux am command to Android Settings ActivityScott Lurndal
+* Re: Termux am command to Android Settings ActivityScott Lurndal
|`- Re: Termux am command to Android Settings ActivityScott Lurndal
+* Re: Termux am command to Android Settings ActivityEli the Bearded
|`- Re: Termux am command to Android Settings ActivityScott Lurndal
`* Re: Termux am command to Android Settings ActivityScott Lurndal
 `- Re: Termux am command to Android Settings ActivityScott Lurndal

1
Termux am command to Android Settings Activity

<sil8pm$9ni$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21569&group=comp.mobile.android#21569

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: sco...@slp53.sl.home (Scott Lurndal)
Newsgroups: comp.mobile.android
Subject: Termux am command to Android Settings Activity
Date: Fri, 24 Sep 2021 22:26:54 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <sil8pm$9ni$1@gioia.aioe.org>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="9970"; posting-host="byfYGra9UYTu3eUW2DIdpA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-newsreader: xrn 9.03-beta-14-64bit
 by: Scott Lurndal - Fri, 24 Sep 2021 19:26 UTC

Anssi Saari showed me how to bring up an Android settings page from Windows.
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity

In my first successful attempt bringing it up on Android I installed Termux.
<https://play.google.com/store/apps/details?id=com.termux>

When I run this inside of Termux, it brings up the Android setting Activity.
$ am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity

Which was the first time I've was able to bring up an Activity on Android
from just the name of the Activity.

The syntax works even for Activities whose name have a dollar sign in them.
$ am start -n com.android.settings/.Settings\$AppMemoryUsageActivity

So now we know it can be done to bring up an Activity from just the name.
But _typing_ that command more than once inside of Termux is a pain.

Is there a good method to make running that command easier outside Termux?
(Can a Termux command create a link to put onto the homescreen for instance?)

Re: Termux am command to Android Settings Activity

<siluq7$1ig$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21655&group=comp.mobile.android#21655

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: sco...@slp53.sl.home (Scott Lurndal)
Newsgroups: comp.mobile.android
Subject: Re: Termux am command to Android Settings Activity
Date: Sat, 25 Sep 2021 04:42:40 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <siluq7$1ig$1@gioia.aioe.org>
References: <sil8pm$9ni$1@gioia.aioe.org>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="1616"; posting-host="byfYGra9UYTu3eUW2DIdpA.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 01:42 UTC

I was able to get a Termux alias to work to bring up an Activity.
But I am not yet able to get a script to bring up the Activity.

Here's what I did to create an alias inside of termux to an Activity.
1. Start Termux as a user (I'm not rooted)
2. $ alias adid="am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity"
3. Typing "adid" in Termux popped up the "reset advertising id" Activity.

Here's what I did to make that alias persistent between boots.
4. $ cat ~/.bashrc
cat /data/data/com.termux/files/home/.bashrc
No such file or directory
5. alias > ~/.bashrc
6. $cat ~/.bashrc
alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
(It changed my doublequotes to singlequotes.)

Here's what I did to test that the ~/.bashrc was working.
7. Termux$ unalias adid
8. $ adid (this failed)
9. $ source ~/.bashrc
10. $ adid (this worked)

I rebooted the phone and that "adid" alias was persistent.
The goal now is to somehow get that alias to be a finger tap.

Re: Termux am command to Android Settings Activity

<sim31i$1e9i$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21665&group=comp.mobile.android#21665

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: sco...@slp53.sl.home (Scott Lurndal)
Newsgroups: comp.mobile.android
Subject: Re: Termux am command to Android Settings Activity
Date: Sat, 25 Sep 2021 05:54:50 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <sim31i$1e9i$1@gioia.aioe.org>
References: <sil8pm$9ni$1@gioia.aioe.org> <siluq7$1ig$1@gioia.aioe.org>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="47410"; posting-host="byfYGra9UYTu3eUW2DIdpA.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 02:54 UTC

I was able to get both an alias & a script to bring up the activity.
(Now we need to try to make it into a homescreen shortcut somehow.)

All the commands below were run inside of Android Termux command windows.

A. Alias
$ alias adid="am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity"
Then "adid" in Termux popped up the "reset advertising id" Activity.

This makes that alias persistent:
$ cat ~/.bashrc
cat /data/data/com.termux/files/home/.bashrc
No such file or directory
$ alias > ~/.bashrc
$ cat ~/.bashrc
alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
(Note it somehow changed my doublequotes to singlequotes.)
$ unalias adid
$ adid (this failed)
$ source ~/.bashrc
$ adid (this worked, which means it pops up the "reset ad id" gui)
I rebooted the phone and it still worked, so the alias is done.

Here is a persistent script that worked.

B. Bash
$ nano ./adid.sh
-- begin file below --
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
--- the file is just two lines ---

$ chmod +x ./adid.sh
$ ./adid.sh (at first that did nothing)

I then tried these suggested workarounds (one or more of which worked).
https://android.stackexchange.com/questions/185682/path-for-bash-in-android-termux
$ pkg install termux-exec
$ termux-fix-shebang ./adid.sh
$ bash ./adid.sh (now it works!)

I haven't been able to get it in the path yet so I don't have to always type
the ./ but other than that, it works and survives an Android phone reboot.

Now I need to figure out how to get either one into a single tap shortcut on
the Android homescreen using only existing free solutions everyone can try.

Re: Termux am command to Android Settings Activity

<eli$2109261649@qaz.wtf>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21752&group=comp.mobile.android#21752

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.panix5.panix.com!qz!not-for-mail
From: *...@eli.users.panix.com (Eli the Bearded)
Newsgroups: comp.mobile.android
Subject: Re: Termux am command to Android Settings Activity
Date: Sun, 26 Sep 2021 20:50:08 -0000 (UTC)
Organization: Some absurd concept
Message-ID: <eli$2109261649@qaz.wtf>
References: <sil8pm$9ni$1@gioia.aioe.org> <sm0czovgze2.fsf@lakka.kapsi.fi>
Injection-Date: Sun, 26 Sep 2021 20:50:08 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="panix5.panix.com:166.84.1.5";
logging-data="17689"; mail-complaints-to="abuse@panix.com"
User-Agent: Vectrex rn 2.1 (beta)
X-Liz: It's actually happened, the entire Internet is a massive game of Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-US-Congress: Moronic Fucks.
X-Attribution: EtB
XFrom: is a real address
Encrypted: double rot-13
 by: Eli the Bearded - Sun, 26 Sep 2021 20:50 UTC

In comp.mobile.android, Anssi Saari <as@sci.fi> wrote:
> Scott Lurndal <scott@slp53.sl.home> writes:
>> Is there a good method to make running that command easier outside
>> Termux? (Can a Termux command create a link to put onto the
>> homescreen for instance?)

I've been following along without an answer. I use Termux a lot but have
not tired it for that. I _have_ rigged it so my image posts go through
it (~/bin/termux-file-editor handles those) and I have a bookmark app
that works with URLs shared with it (~/bin/termux-url-opener).

> Basically it seems the guy had a few lines of textual information to
> share but he turned that into a video. Literally a video showing
> text. Not actually showing how like an actual screen recording.

Urgh.

> Thankfully the video's only two minutes but stupid nevertheless. The
> first solution uses Termux:Widget, in short Termux:Widget should make
> scripts placed in ~/.shortcuts selectable in launcher shortcuts. Seems
> promising.

I've never used that. Here's a little bit more documentation:

https://wiki.termux.com/wiki/Termux:Widget

> His other suggestion is Termux:Task and then Tasker and compatible apps
> like Automate should be able to run scripts placed in ~/.termux/tasker.
>
> I haven't tried either but hopefully these work.

I used to use Tasker for "cron" jobs. Basically I created a pair of
scripts, one to run every five minutes (which was a termux-sensors
wrapper to record sensor data) and another to run every two hours that
rsynced the data off of the device. Then I had Tasker actually run them
on that schedule. It worked well, but Tasker is not free and I'm unclear
if OP wants this script to run on a fixed schedule like that.

Elijah
------
suggests searching github for example code

Re: Termux am command to Android Settings Activity

<sirfs5$k4i$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21755&group=comp.mobile.android#21755

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: sco...@slp53.sl.home (Scott Lurndal)
Newsgroups: comp.mobile.android
Subject: Re: Termux am command to Android Settings Activity
Date: Mon, 27 Sep 2021 07:04:30 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <sirfs5$k4i$1@gioia.aioe.org>
References: <sil8pm$9ni$1@gioia.aioe.org> <sm0czovgze2.fsf@lakka.kapsi.fi>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="20626"; posting-host="byfYGra9UYTu3eUW2DIdpA.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 - Mon, 27 Sep 2021 04:04 UTC

Anssi Saari writes:
> I haven't tried either but hopefully these work.

Thanks Anssi for looking up the solution because NOBODY knows how to do this
but us - as far as I can tell - but when we're done - EVERYONE will be able!

The goal now is to pop up _any_ Activity by tapping on an icon, where, (and
this is important), where the ONLY thing you know is the Activity name.

A further goal would be to _press a button_ on that Activity!
(e.g., to hit the "reset" button in the "Reset Advertising ID" Activity)

We'll get there - where I know you realize that it takes HOURS (sometimes 5
or 10 hours or more) for each solution due to the experiments involved.

Just that one extra reset press hurdle has taken me more hours of research.

BTW, I think I solved most of this yesterday but I was too busy today to do
all the tests that I do before I post to ensure others can just cut and
paste our results (which makes it look so simple to them which is the goal).

BTW, I'm pretty sure _this_ will be our solution but I haven't had the time
to run the complete syntax testing so I just point you to it for now.
<https://wiki.termux.com/wiki/Termux:Widget>

Given I had a Google Play Termux, yesterday I had to wipe out the Android
phone and start again with the F-Droid Termux, and today I was just too busy
to repeat all the syntax checks to give out the solution in this thread yet.

But I think that Termux:Widget will run scripts as an icon on the desktop
where what worries me more is how to extend that to "press" the buttons!

I think only you realize how difficult this is, given the solution isn't
already tailored for us, but when we publish the steps, they'll do it in
minutes and think it was all so easy. :)

Re: Termux am command to Android Settings Activity

<sirqpn$9ms$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21758&group=comp.mobile.android#21758

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: sco...@slp53.sl.home (Scott Lurndal)
Newsgroups: comp.mobile.android
Subject: Re: Termux am command to Android Settings Activity
Date: Mon, 27 Sep 2021 10:10:56 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <sirqpn$9ms$1@gioia.aioe.org>
References: <sil8pm$9ni$1@gioia.aioe.org> <sm0czovgze2.fsf@lakka.kapsi.fi> <eli$2109261649@qaz.wtf>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="9948"; posting-host="byfYGra9UYTu3eUW2DIdpA.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 - Mon, 27 Sep 2021 07:10 UTC

Eli the Bearded writes:
> I've been following along without an answer.

As far as anyone has been able to find out, the answer didn't exist.
Nobody could find the answer anywhere on the Internet (AFAICT).

Until this very moment.
I solved the stated problem (with key adb syntax help from Anssi).

I have an "icon" on my homescreen, which pops up the Reset Ad Id Activity.
That "Reset Ad Id" Activity was created knowing _only_ the Activity name!
(See solution appended elsewhere in this thread.)

> I've never used that. Here's a little bit more documentation:
> https://wiki.termux.com/wiki/Termux:Widget

That sucks because it does absolutely nothing, but it's required to run
those steps so it's a required reference (it just sucks, that's all).

> I used to use Tasker for "cron" jobs.

The goal is _always_ it has to be free so that everyone can do it.

> I'm unclear if OP wants this script to run on a fixed schedule like that.

It would be nice to trigger the reset of the ad id on some common event.
For example, upon unlocking of the screen (or whatever).

Re: Termux am command to Android Settings Activity

<sirr5b$eno$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=21759&group=comp.mobile.android#21759

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!byfYGra9UYTu3eUW2DIdpA.user.46.165.242.75.POSTED!not-for-mail
From: sco...@slp53.sl.home (Scott Lurndal)
Newsgroups: comp.mobile.android
Subject: Re: Termux am command to Android Settings Activity
Date: Mon, 27 Sep 2021 10:17:07 +0300
Organization: UsenetServer - www.usenetserver.com
Message-ID: <sirr5b$eno$1@gioia.aioe.org>
References: <sil8pm$9ni$1@gioia.aioe.org> <sm0czovgze2.fsf@lakka.kapsi.fi> <sirfs5$k4i$1@gioia.aioe.org>
Reply-To: slp53@pacbell.net
Injection-Info: gioia.aioe.org; logging-data="15096"; posting-host="byfYGra9UYTu3eUW2DIdpA.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 - Mon, 27 Sep 2021 07:17 UTC

Scott Lurndal writes:
Scott Lurndal <scott@slp53.sl.home> asked
> I think only you realize how difficult this is, given the solution isn't
> already tailored for us, but when we publish the steps, they'll do it in
> minutes and think it was all so easy. :)

Nowhere on the Internet have I been able to find this tutorial.
It took many hours to write this up but now it works in five minutes!
I put it in cut-and-paste format. So it's easy to test.
Please test it out to see if it works for you & report back your results.

For the first time ever...
a. Tapping the homescreen icon now brings up the "Reset Ad Id" form.
b. It's not a shortcut but a widget (but I don't know if/how that matters).
c. We only need to figure out how to make it _press_ the "Reset" button!

Here are cut and paste instructions anyone can follow in 5 minutes!
1. Install F-droid <https://f-droid.org/>
<https://f-droid.org/F-Droid.apk>
2. Install F-Droid Termux <https://f-droid.org/en/packages/com.termux/>
<https://f-droid.org/repo/com.termux_117.apk>
3. Add F-Droid Termux Widget <https://f-droid.org/en/packages/com.termux.widget/>
<https://f-droid.org/repo/com.termux.widget_12.apk>
4. Run the F-Droid Termux & create an alias we'll name "rad" for reset ad id.
$ rad
(This should report: No command rad found)
$ alias rad 'am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
$ rad
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programmatically close it later)
$ cat ~/.bashrc
cat /data/data/com.termux/files/home/.bashrc
No such file or directory
$ alias > ~/.bashrc
$ cat !$
alias rad='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
$ unalias rad
$ rad
(This should report: No command rad found)
$ source ~/.bashrc
$ rad
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programatically close it later)
5. Run the F-Droid Termux and create two directories for the shortcut widget
$ mkdir -p $HOME/.shortcuts (we will put our shell script here)
$ mkdir -p $HOME/.shortcuts/tasks (we didn't use this directory yet)
6. Create a shell script to open up the reset ad id Activity.
$ cd $HOME/.shortcuts
$ nano ./rad.sh
Edit the result to look like this:
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
$ chmod +x ./rad.sh
$ ./rad.sh
(nothing will happen)
7. Modify termux to be able to execute user shell scripts on Android.
$ pkg install termux-exec
8. Test your shell script.
$ ./rad.sh
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programmatically close it later)
9. Add the Termux Widget to your homescreen.
Long press your Android homescreen.
Select "Widgets" & then "Termux:Widget" & place it on your Android homescreen.
It will ask: Create widget and allow access? to which you press "Yes"
Then press the "rad.sh" entry showing up in that Termux Widget.
"Termux requires "Display over other apps" permission
to start terminal sessions from background on Android >=10."
"Grants it from Settings -> Apps -> Termux -> Advanced"
10. Grant Termux permission to display over other apps:
Android11:Settings > Apps > Your apps > Termux > Appear on top = (change off to on)
11. Now press the Termux Widget entry named "rad.sh"
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programmatically close it later)
12. Reboot the phone & ensure everything is persistent.
Tap the new homescreen icon after rebooting
& the "reset ad id" Activity should pop up.

What's left?
Figure out how to add a step to actually _press_ the "Reset" button!
--
Don't mix Google Play Termux add ons with F-Droid Termux add ons.
<https://www.xda-developers.com/termux-terminal-linux-google-play-updates-stopped/>
Use only the F-Droid Termux and only the F-Droid Termux add ons.
<https://wiki.termux.com/wiki/Termux:Widget>
If you installed the Google Play Termux, you need to migrate it to F-Droid.
<https://docs.andronix.app/termux/migrating-to-f-droid/>

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor