Android Question 2 last questions (1 might be "Crazy")

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
pals, after long time of back and forth where i asked and you answered and helped very much i am now on my "last mile" to finish my process with my apps.
so firstly thank you.

here are my two questions:

1:
is there a way to detect if an app is installed on the phone?
i have 2 apps A & B
A is the main (sdk 31) - i need to detect if B is installed (b is sdk 30 so it will be on external server not google store :))
i know how to catch the error if it does not exist when i need to run it, but i want to detect it before and with no dependency on running it
it is critical to take into account that it will run on all android versions including 13 and the app is on sdk 31 (on older versions i managed to do that but i need a solid solution for future sdks

2: (this is the "crazy" one)
can i add an apk file to my files in app A and run it to install it?
the meaning is to add app B's apk to the files list of app A and the use it to install on the device if it does not exist
this way i will not have to send the client to download it (currently i load it using the browser and installs it from the browser)
this way it will be much easier to update and maintain both apps and no need to store it in 3rd location
will it pass google store ?
is it really crazy or can i do it? (how?)

thankss
 

Alexander Stolte

Expert
Licensed User
Longtime User
1:
is there a way to detect if an app is installed on the phone?
i have 2 apps A & B
A is the main (sdk 31) - i need to detect if B is installed (b is sdk 30 so it will be on external server not google store :))
i know how to catch the error if it does not exist when i need to run it, but i want to detect it before and with no dependency on running it
it is critical to take into account that it will run on all android versions including 13 and the app is on sdk 31 (on older versions i managed to do that but i need a solid solution for future sdks
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
1: I already pointed you to a thread with an answer you could try as long as you know the package name you are looking for. See post #7
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
1: I already pointed you to a thread with an answer you could try as long as you know the package name you are looking for. See post #7
Thanks, I will check it...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
2: (this is the "crazy" one)
can i add an apk file to my files in app A and run it to install it?
You already asked this question and you got answers for it.
It is - still - not possible. Even when asking again.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
It is - still - not possible. Even when asking again.
I'm not sure. If, as he said, the apk is in Files as an asset then theoretically it could be copied to a folder and then installed by the app as long as it had install packages permission. After all B4ABridge does this - just the source of the apk would be internal and not from the network. It would enormously bloat the loading apk so is probably impractical from that point of view.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
This question already been asked previously

B4A-Bridge is approved/available in play store.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
1: I already pointed you to a thread with an answer you could try as long as you know the package name you are looking for. See post #7
Tried it.
Unfortunately it doesn't work on Android 13 and sdk 31
On older versions it works perfectly but not Android 13
So this is no solution...

Any suggestions?
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
I'm not sure. If, as he said, the apk is in Files as an asset then theoretically it could be copied to a folder and then installed by the app as long as it had install packages permission. After all B4ABridge does this - just the source of the apk would be internal and not from the network. It would enormously bloat the loading apk so is probably impractical from that point of view.
Thanks
This is exactly whatvibwant to do.
I'm not worried as per size as my second app is tiny so this is not an issue

The question is how practically do it?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Unfortunately it doesn't work on Android 13 and sdk 31
It does work if you do what post #7 in that thread says. I just tried it. You are doing something wrong. Put this in your manifest, with the correct package name, and GetApplicationIntent will show you that the package is installed.

B4X:
AddManifestText(<queries>
     <package android:name="jhs.atr"/>
</queries>)
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
The question is how practically do it?
Read the first post here. You probably can't use it in a store app.

Particularly note the line - my boldening
The REQUEST_INSTALL_PACKAGES permission may not be used to perform self updates, modifications, or the bundling of other APKs in the asset file unless for device management purposes. All updates or installing of packages must abide by Google Play’s Device and Network Abuse policy and must be initiated and driven by the user.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
It does work if you do what post #7 in that thread says. I just tried it. You are doing something wrong. Put this in your manifest, with the correct package name, and GetApplicationIntent will show you that the package is installed.

B4X:
AddManifestText(<queries>
     <package android:name="jhs.atr"/>
</queries>)
Exactly what I did
On older versions it works
I will recheck...
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Read the first post here. You probably can't use it in a store app.

Particularly note the line - my boldening
Yes, I guessed it, dropped the idea and will keep on storing the apk on my server for browser download and installation
Thank you
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Now that you have solved your problem with ample help, it is time for you to change the title of the thread to a more descriptive one to help all who read it and search for something similar. The way it is now, it is absolutely meaningless and it cheapens the forum big time.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Now that you have solved your problem with ample help, it is time for you to change the title of the thread to a more descriptive one to help all who read it and search for something similar. The way it is now, it is absolutely meaningless and it cheapens the forum big time.
I will gladly do it
Any suggestion for the text?
I'll appreciate it...
 
Upvote 0
Top