installing an apk from csentry

Discussions about creating CAPI applications to run on Android devices
Post Reply
AriSilva
Posts: 595
Joined: July 22nd, 2016, 3:55 pm

installing an apk from csentry

Post by AriSilva »

Hi folks,
In my previous applications, using android 5.5, I used the following commands to install an apk from my csentry program:

string apk = pathconcat(Application, "..\..\30_Apoio\app-debugVersion12-1.apk");
ret = execsystem(maketext("view:%s", apk), wait);

The idea is to install the apk stored in that folder specified in apk.
Apparently it is not working anymore, and I do not know if the guilty guy is the android version, or something changed in cspro.
By the way, this ...apk is uploaded to this directory using the deploy utility, or course. And the idea is to install the application at the beginning of the csentry application execution just once (I check some conditions to make sure it needs to be installed).
Another question is: Is there a way to use the deploy to upload a file in another area not controlled by the application (in the download folder for instance)?
Best
Ari
Best
Ari
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: installing an apk from csentry

Post by Gregory Martin »

We haven't changed anything in CSPro related to this, so it's related to Google's continual locking down of the Android ecosystem.

According to this, https://medium.com/@vishtech36/installi ... 39cfe22b86, Installing applications might be possible if we requested the REQUEST_INSTALL_PACKAGES permission, but that would prevent CSEntry from being added to Google Play, so we won't do that.

Regarding copying files to a directory other than the CSEntry one, you can write to the Downloads directory, at least using CSPro 8.0. However, you can't do that as part of the deployment process, only using logic. Here was the test code I used to do this in 8.0:
string source = CS.Path.selectFile();
string dest = Path.concat(Downloads, maketext("%s-%d%s", Path.getFileNameWithoutExtension(source), timestamp(), Path.getExtension(source)));
errmsg("%d %s", filecopy(source, dest),
                CS.File.copy(source := source, destination := dest));
(You'll have to see what errmsg prints out, to see which works of filecopy or CS.File.copy. I'm thinking they both work, but I haven't updated the documentation in 8.0 regarding these yet, so I forget off the top of my head.)

You could potentially copy the .apk to the Downloads directory and have the user use the Android file browser to install the application.
Post Reply