Setting permissions on Android

Kanzi Monitor writes trace files to the host application’s internal storage (Context.getFilesDir()), which does not require any manifest permission. The only Android permission Kanzi Monitor requires is network access for the remote console (TCP) and the Monitor Web UI bridge.

Setting permissions in the manifest file

In the application manifest file, add the INTERNET permission:

<uses-permission android:name="android.permission.INTERNET"/>

The integrate tool, and the Application Integration section of the Kanzi Monitor plugin for Kanzi Studio, add it for you. See the integrate tool and Using the Kanzi Studio plugin. The remote console needs the permission also when you connect through adb forward: Kanzi Monitor opens a socket in the application either way. Without it, the log shows createSocket : Socket creation failed and the application runs without the remote console.

Connecting from the host computer

To connect the RemoteConsoleClient, the Monitor Web UI, the MCP server or the Kanzi Studio plugin’s tools to an application on an Android device that is connected with USB, or in the Android Emulator, forward the remote console port with adb:

adb forward tcp:56000 tcp:56000

The tools then connect to 127.0.0.1, port 56000, as they do by default. The forward lasts until the device disconnects or the adb server stops. Run it again after you reconnect the device or restart the emulator. When the application uses another RemoteConsolePort, forward that port. With more than one device connected, select the device with adb -s <serial> forward.

A device on the same network as the host computer is also reachable at its own IP address, without adb.

Note

Kanzi Monitor 1.40.0 wrote traces to external storage (/sdcard/), which required MANAGE_EXTERNAL_STORAGE (SDK 30 and later) or WRITE_EXTERNAL_STORAGE (earlier SDKs). Starting in 1.41.0, traces go to internal storage and neither permission is needed for Kanzi Monitor. Starting in 1.41.2 this includes kzTrace captures (overwatch.kztrace), which previously reached the engine’s own default destination /sdcard/Download/ and were the one remaining consumer of a storage permission. Remove the permissions unless your host application uses them for other reasons. See Migration guides for the trace-output-path change and how to copy traces off the device with adb run-as.

Enabling profiling on release builds

To capture traces with Android Performance Analyzer or the perfetto CLI against a release-style build (e.g. using the perfetto-producer writer), declare the application as profileable in the manifest. This lets shell tools attach without requiring android:debuggable="true", which would change runtime performance characteristics.

<application>
    <!-- your existing application attributes and content -->
    <profileable android:shell="true" />
</application>

This is required when ActiveWriters includes perfetto-producer (see Configuring Kanzi Monitor) — Perfetto’s traced daemon will refuse to collect events from a process that is neither debuggable nor profileable.

See also

Getting started with Kanzi Monitor