Welcome to Headwind MDM Q&A, where you can ask questions and receive answers from other members of the community.

Please do not post bug reports, missing feature requests, or demo inquiries. If you have such an inquiry, submit a contact form.

0 votes
We would like to add another parameter to logs.

How do we add one additional parameter to the plugin_devicelog_log and add one new column to it?
by (37.4k points)

1 Answer

0 votes

You will need to modify both the back-end and the mobile application.

Back-end

First, I recommend you to build the back-end in the IDE (IDEA is recommended), see details here: https://h-mdm.com/web-panel-dev-2/. Once you build the WAR file and check that it is working well by deploying it to your server, you can modify the source code.

The log plugin code is located in plugins/devicelog/ directory. The log plugin is historically split into two modules: "core" and "postgres" (because initially it was assumed that log may be stored in different formats). 

To modify the database, you need to:

- add the updating SQL command in the database migration file: plugins/devicelog/postgres/src/main/resources/liquibase/devicelog.postgres.changelog.xml

- modify the model class DeviceLogRecord and persistence class DeviceLogDAO

- if the modification should be displayed in the web part, modify the REST API class DeviceLogResource, and the JavaScript web application code src/main/webapp/views/logs.html and src/main/webapp/devicelog.module.js

Mobile application

The client (launcher) must first be built in Android Studio. After you successfully build the launcher, you can modify its source code.

Logs are cached in the SQLite database, so you must implement migration in the mobile app as well. See how migrations are done in db/DatabaseHelper.java. The db class related to logs is db/LogTable.java

Also, you will need to change the model class json/RemoteLogItem.java.

The log engine is implemented in util/RemoteLogger.java (logging to the local database) and worker/RemoteLogWorker.java (uploading logs to the server).

by (37.4k points)
...