Android Question Press web browser button from B4A code

amorosik

Well-Known Member
Licensed User
On my app I have a routine that starts the phone web browser on a certain address, using StartActivity OpenBrowser
The address I give him is actually the name of a file, which the browser must download, something like http://www.pippo.com/file1.apk
When the instruction is executed, the browser opens correctly and attempts to download the file but stops at the operator's request for confirmation, proposing the DOWNLOAD or CANCEL button
The question is: from app code, how to press that button?
Or, is there a way to instruct the browser not to request confirmation from the operator?
 

Sandman

Well-Known Member
Licensed User
So basically you're asking how to make the browser download an apk without user confirmation? That sounds like something malware would do, what could possibly be the reason for why you want to do this?
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
why do you even need the browser? just use okhttputils2 to download the file. no buttons, no confirmations.

making buttons on a webpage click from an app is possible using javascript injection, but not under the conditions you describe.

while it is possible to make a browser do something with javascript injection, you would have a very hard time making it not do something.

i would like to see exactly how these buttons magically appear. what's the url? and provide a file that exists to download.
 
Upvote 0

amorosik

Well-Known Member
Licensed User
So basically you're asking how to make the browser download an apk without user confirmation? That sounds like something malware would do, what could possibly be the reason for why you want to do this?

The reason is that I have to do the same operation on dozens of phones and I would like to automate the app program update installation that I have provided
 
Upvote 0

amorosik

Well-Known Member
Licensed User
why do you even need the browser? just use okhttputils2 to download the file. no buttons, no confirmations.

making buttons on a webpage click from an app is possible using javascript injection, but not under the conditions you describe.

while it is possible to make a browser do something with javascript injection, you would have a very hard time making it not do something.

i would like to see exactly how these buttons magically appear. what's the url? and provide a file that exists to download.

Yes, you're right, I hadn't thought about it
So for downloading from pc to phone I can use okHttpUtils
Now that I have the apk file on my phone, how do I start it and allow my app to be updated?
I specify that I pass the apk file from pc to Android using app1, while the apk I'm starting to update an app is related to app2
 
Upvote 0

José J. Aguilar

Expert
Licensed User
Have you seen this lib?

 
Upvote 0

amorosik

Well-Known Member
Licensed User
Have you seen this lib?


Yes. but also this lib need the operator 'press button'
What i would like to obtain is an app update of a complete non presidiate device
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
Yes, you're right, I hadn't thought about it
So for downloading from pc to phone I can use okHttpUtils
Now that I have the apk file on my phone, how do I start it and allow my app to be updated?
I specify that I pass the apk file from pc to Android using app1, while the apk I'm starting to update an app is related to app2

first, when you go to play and there is an update available,
you click to install. is this really so difficult or invasive? maybe
we don't want to update. maybe we do. yes, it is possible to
configure automatic updating, but my point is the user is
informed of something, and then a decision is made by the user.

it seems to me that you want to bypass the rights of the user
by basically doing something without telling them. just sayin'.
(maybe you give them the chance to opt out before sending them
to the url. i can't say what your app does.)

as to how you would do it, maybe member aguilar's suggestion
is the answer. see what the story is.

in my case, if i want to deploy an app to one of my devices
without recompiling, i simply drag the .apk from the pc over
to the device. i leave it in the "files" folder. (maybe your
device says "downloads". whatever.) when i go to my files
folder and tap on the .apk, the system offers to install it.
so, what i'm saying is that if you download the .apk with
okhttputils2 and save it in the files folder (with a provider),
i think your app could open the files folder and the user taps
on the .apk for installation. 1 step.

i have apps that save to the files folder, but i've not tried to
open the folder (presumably with an intent). i don't see why
it wouldn't work. although i wonder what android does if an
app which is to be updated is already running. some systems
won't allow it. maybe android kills the running app before
installing over it...

if jose aguilar's link will handle an automatic install, fine. i do
think the decision should be the user's.

the whole story with the buttons on the browser might possibly
be avoided; you didn't provide any data to allow somebody to test.
ok, i see it's one of your apps, so maybe you don't want to give it away.
just leave something out there for download. if you want to
see about the buttons, let somebody else see what happens.
 
Upvote 0

DonManfred

Expert
Licensed User
Yes. but also this lib need the operator 'press button'
This is an Android-Restriction which you can not override!

This is a mandatory rule in android. The deviceuser HAVE TO confirm the installation.

Sounds like you are building your solution on features which does not exists in android.
 
Upvote 0

amorosik

Well-Known Member
Licensed User
first, when you go to play and there is an update available,
you click to install. is this really so difficult or invasive? maybe
we don't want to update. maybe we do. yes, it is possible to
configure automatic updating, but my point is the user is
informed of something, and then a decision is made by the user.

it seems to me that you want to bypass the rights of the user
by basically doing something without telling them. just sayin'.
(maybe you give them the chance to opt out before sending them
to the url. i can't say what your app does.)

as to how you would do it, maybe member aguilar's suggestion
is the answer. see what the story is.

in my case, if i want to deploy an app to one of my devices
without recompiling, i simply drag the .apk from the pc over
to the device. i leave it in the "files" folder. (maybe your
device says "downloads". whatever.) when i go to my files
folder and tap on the .apk, the system offers to install it.
so, what i'm saying is that if you download the .apk with
okhttputils2 and save it in the files folder (with a provider),
i think your app could open the files folder and the user taps
on the .apk for installation. 1 step.

i have apps that save to the files folder, but i've not tried to
open the folder (presumably with an intent). i don't see why
it wouldn't work. although i wonder what android does if an
app which is to be updated is already running. some systems
won't allow it. maybe android kills the running app before
installing over it...

if jose aguilar's link will handle an automatic install, fine. i do
think the decision should be the user's.

the whole story with the buttons on the browser might possibly
be avoided; you didn't provide any data to allow somebody to test.
ok, i see it's one of your apps, so maybe you don't want to give it away.
just leave something out there for download. if you want to
see about the buttons, let somebody else see what happens.


What do you mean "when you go to play"?
If you mean Play Store, no one has talked about downloading from Play Store
My app, which we will call App1, is not on the Play Store
I have dozens of phones, all the same, on which App1 is running
Periodically it is necessary to update App1
I would like to find a way to do it while sitting comfortably in front of my pc, without connecting with any phone just to press the keys and confirm the update
I see you were talking about "driving a browser" with javascript injection
Perhaps you can do the same with the App1 update procedure which requires confirmation from the operator
Someone suggests to me that using the Accessibility Services maybe you can get what I ask for
Unfortunately I have never used them and therefore I am not able to know if it is possible to use them or not
 
Upvote 0

amorosik

Well-Known Member
Licensed User
This is an Android-Restriction which you can not override!

This is a mandatory rule in android. The deviceuser HAVE TO confirm the installation.

Sounds like you are building your solution on features which does not exists in android.

Do you say that even using Accessibility Services cannot be done?
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
What do you mean "when you go to play"?
If you mean Play Store, no one has talked about downloading from Play Store
My app, which we will call App1, is not on the Play Store
I have dozens of phones, all the same, on which App1 is running
Periodically it is necessary to update App1
I would like to find a way to do it while sitting comfortably in front of my pc, without connecting with any phone just to press the keys and confirm the update
I see you were talking about "driving a browser" with javascript injection
Perhaps you can do the same with the App1 update procedure which requires confirmation from the operator
Someone suggests to me that using the Accessibility Services maybe you can get what I ask for
Unfortunately I have never used them and therefore I am not able to know if it is possible to use them or not
you misunderstood. i know your app is not on play. my point was that there is a decision made by the user. even google understands this.

you simply wish to control what's running on your users' phones. you could make your users download anything! this is what member sandman
was saying. it's what member donmandred is saying. it's what i'm saying. there has to be a decision on the part of the user. at some point in
the process. when you are willing to accept this, i'm sure people will be happy to help.
 
Upvote 0

amorosik

Well-Known Member
Licensed User
you misunderstood. i know your app is not on play. my point was that there is a decision made by the user. even google understands this.

you simply wish to control what's running on your users' phones. you could make your users download anything! this is what member sandman
was saying. it's what member donmandred is saying. it's what i'm saying. there has to be a decision on the part of the user. at some point in
the process. when you are willing to accept this, i'm sure people will be happy to help.

Do you say that even using Accessibility Services cannot be done?
 
Upvote 0

amorosik

Well-Known Member
Licensed User
Do yo mean user's phones, or remote phones without users with an app running you want to automatically update because there's no users using that phones?

They are telephones used by an operator
The operator, due to age and training, does not always know how to perform or wants to perform operations that are not his / her own, such as updating apps
And every time an update is released, it is possible the previous version of the system is not perfectly compatible with the new app version and therefore having 10 updated apps and other 10 not updated ones could affect the functioning of the entire system.
For these and other reasons I would like to have the possibility to update the app installed remotely, without the need for intervention by the telephone operator
Currently, the update operation is performed via remote assistance, but it takes a lot of time, uselessly
 
Upvote 0
Top