android 11, accessing csentry files from other apps

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

android 11, accessing csentry files from other apps

Post by AriSilva » October 2nd, 2021, 1:08 pm

Hi folks,
My application, which is still working with android 5.1.1, calls an external application to take some photos of the vaccine annotations of each children.
In order to do that, and to facilitate the interviewers, the first time the out application is called, it installs the photo application, by

string apk = pathconcat(Application, "..\..\..\foto.apk");
ret = execsystem(maketext("view:%s", apk), wait);

it prompts a screen asking the interviewer to install the photo app.

Then, during the interview, this photo app is called from our csentry application, storing some information in a file "identificador.txt" that the photo app has to read to get the identification that should be attached to the photo filename.

In the android 5.5 it works fine, both steps, the installation and the calling to the photo.
But, in android 11 both steps do no work. First, when doing the execsystem in the first step, nothing happens, and the photo app is not installed.

Then, after installing the photo.apk by hand, and trying to call it from the csentry app, the system shows a message that there is no permission to open the "identificador.txt" file (see attached the figure with the message)

It seems that the photo app cannot have access to this file that is stored inside the csentry realm.
The million dollar question? What can we do in both cases?
Best
Ari
Attachments
permission_denied.png
permission_denied.png (15.78 KiB) Viewed 1488 times
Best
Ari

Gregory Martin
Posts: 1552
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: android 11, accessing csentry files from other apps

Post by Gregory Martin » October 4th, 2021, 8:06 am

I'm not sure there is a workaround to installing the application other than having the enumerators install it manually.

In terms of sharing information, look into the SystemApp object: https://www.csprousers.org/help/CSPro/systemapp.html

You can use the setArgument function to pass the ID information to the other application. You'll have to modify your foto app to read that information from the Intent Bundle rather than from a file in the csentry directory. See more here: https://www.csprousers.org/help/CSPro/s ... ction.html

Here is an example of getting data from CSPro in an Android application: https://github.com/CSProDevelopment/CSE ... ctivity.kt

AriSilva
Posts: 512
Joined: July 22nd, 2016, 3:55 pm

Re: android 11, accessing csentry files from other apps

Post by AriSilva » October 4th, 2021, 1:26 pm

Thanks, Greg,
I´ll try that approach to call the photo app passing parms.
The interesting thing is that in android 5. we were able to install an external app just doing an execsystem(view).
Best
Ari
Best
Ari

AriSilva
Posts: 512
Joined: July 22nd, 2016, 3:55 pm

Re: android 11, accessing csentry files from other apps

Post by AriSilva » October 6th, 2021, 5:17 pm

Hi folks,
I´m still struggling with the connection between my csentry app and an external photo app.
The problem is not only to take a photo, but to store the photo (with a specific filename) in a folder that csentry can read to upload the photo later to our server.
So, let´s try another approach:
Is there a way for the csentry take a photo and store it inside a known directory?
Is there a way for the csentry show that photo to the interviewer to decide if the quality is good enough, or having to take another one?
Best
Ari
Best
Ari

Gregory Martin
Posts: 1552
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: android 11, accessing csentry files from other apps

Post by Gregory Martin » October 6th, 2021, 7:40 pm

Is there any reason you can't use CSEntry to take the photo?

https://www.csprousers.org/help/CSPro/camera.html

Something like:
string temp_image_filename = path.concat(application, maketext("%d.jpg", timestamp()));

execsystem("camera:" + temp_image_filename + "|Take a photo of XXXXX.");

if fileexist(temp_image_filename) then

    errmsg
("Examine the photo and determine if it is usable.");

   
view(temp_image_filename);

   
accept("Was this photo usable?", "Yes", "No"); // ...
If you have to use another application, make sure that that application is saving the photo in an accessible location:

https://developer.android.com/reference ... MediaStore

You can use filecopy to move files from a location accessible via the Media Store to within the CSEntry ecosystem.

In CSPro 7.7, which is coming out shortly, we're actually adding support for querying the Media Store, so this task will be even easier in the next release.

AriSilva
Posts: 512
Joined: July 22nd, 2016, 3:55 pm

Re: android 11, accessing csentry files from other apps

Post by AriSilva » October 7th, 2021, 6:42 pm

Thanks again, Greg,
I´ll try also this new approach using the camera.
Getting back to the SystemApp approach, by calling my photo app, like

string identificacao = maketext("%s", key(ICV10_10_ENTREVISTA_DICT));

SystemApp photoApp;

photoApp.setArgument("identificacao", identificacao);
ret = photoApp.exec("app:science.foto");

I do not see any flag parameters to wait for the result, such as we have in the execsystem we were using before, such as
ret = execsystem("app:science.foto", wait);
And what you said about storing the pictures, we are using the memory card to store the photo(s), but I´m not sure that this will be feasible in Android 11.
Best
Ari

Gregory Martin
Posts: 1552
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: android 11, accessing csentry files from other apps

Post by Gregory Martin » October 25th, 2021, 8:54 am

With SystemApp, when you specify the application name, don't put "app:" in front of it. Exec will launch the activity and wait for it to end, so by default it launches it and waits for a result.

Post Reply