Read information from another app

Solved
SD
Stefan Dumitrache
Orbico Croatia

Is it possible to read some information like names or IDs from another installed application on a Soti managed device?

For example we have an app called Route Master ( or Sono) and for the sake of security we want to know the name of the person that is using each device. To use Route Master each user has to insert an unique ID and name in the app, sort of like an account.

2 years ago
SOTI MobiControl
ANSWERS
ZC
Zafer Cigdem
2 years ago

Hi Stefan,

If you don't use shared device, in addition to exporting some value from the Route Master/Sono apps onto the device side as .text/html/ini format or such and use "custom data" from MobiControl to collect the data, you can also use Android Javascript APIs for your Android devices by using user input Text feature. But this way, user should enter their username manually onto the text prompt that they will receive. If it may fit what you need, you can trigger sending this script every 6 hours or such to let the user fill in their username or account number to get this information by using Task Scheduler profile for periodic task.

You can use below JS script to collect this data onto Mobicontrol webconsole on device information details section via custom data; source: Class: TextPromptDialog | Android Agent JavaScript (soti.net)


var file = new mobicontrol.io.File('/sdcard/Download/user_name.ini'); mobicontrol.message.createTextPromptDialog('What is your name/account number?') .withCallback(onConfirm).show(); function onConfirm(result) { mobicontrol.log.info(result.inputText); mobicontrol.message.createInfoDialog("Text by user is:" + result.inputText).show(); var textContent = "[User]\n UserName=" + result.inputText; file.writeText(textContent); }


To highlight the spaces (it may be missing above), I'm sharing the Screenshot version of above code below:

When you send this out this script, user should see something like below to fill in their information.

As soon as user fill in any information and click on "OK", it will create an .ini file under /sdcard/Download/ as "user_name.ini that contains user input. You can see details about custom data here: Custom Data (soti.net) or other SOTI Pulse blog as well to set up custom data and get his information on device details section. I hope it helps. Thank you

Zafer

Solution
SD

Hello Zafer

Thanks for the info. Yeah something like this could work, provided I can trust every employee will enter their real name or ID

I am not at all familiar with Custom Data in Soti. Is it a simple function that by defaults write whatever I tell it to read to a predefined field in Device Information in the SOTI Control Panel or can I point it to write wherever I want? 

ZC
Zafer Cigdem
2 years ago

Hello Stefan,

This is different topics you can find other post here on SOTI Pulse but to help you out; For custom data steps, you can view here: Custom Data (soti.net) There are different options here, you may prefer "Build Type: INI File" option (other works for different file type as well). 

Here is a quick steps for you after sending out the above Javascript scripts to your test device:

- verify that you can see the .ini file on your device side at the path of %sdcard%/Download/user_name.ini

- create custom data source link is above; quick steps are below Screnshoots.

If this works for you, you can do this for group level, and you can see this info for your all device. Feel free to customize the information instead of my name on the process.

I hope this helps. Thank you

Zafer

SD

Thank you very much

Very insightful info. I will try and follow these stepts and mark this answer as solution if I dont run into any issues 

ZC
Zafer Cigdem
2 years ago

It's a pleasure! If you don't see custom data direct onto the device information panel side, you may wait little bit more to get this data synced and be visible, or you can go to hamburger menu (on the top left corner) --> Global Settings --> Console Settings --> Search Index Sync --> click on Sync Now button to make it close to %100.

 And then go back to the side and check it out again. 

Zafer

M
MPMOD@SOTI
2 years ago
MD
Matt Dermody Diamond Contributor
2 years ago

There is a concept called Custom Data in SOTI whereby you can configure the device to report a property from a file like an .ini file on the device. In order for that concept to work the file needs to be saved in a public storage directory accessible by the SOTI agent. Therefore it's theorhetically possible but the routeMaster app would need to save this info to a file that is also accessible from the SOTI agent. If the app is otherwise just storing it in app cache there is no way for the SOTI agent to extract that data.