Skip to main content
Version: 4.6.2-saas

Android Agent FAQ

Q. I get errors due to code optimization.

A. When deploying your app, if you enable app optimization, you must exclude the NetFUNNEL Android agent from optimization. To do this, add the following rules to your proguard-rules.pro file to exclude the agent:

# Protect NetFUNNEL Android agent’s main packages and classes
-keep class com.nf4.** { *; }

# Keep reflection-related classes and members used internally by the NetFUNNEL Android agent
-keepclassmembers class com.nf4.** { *; }

Q. I want to check debugging log messages.

A. To debug, you can check the log messages generated by the NetFUNNEL Android agent as follows:

  1. Set printLog=true in the initialization function.

  2. In Android Studio, go to Logcat and filter by package:mine NetFUNNEL.

info

It is recommended to use printLog=true for debugging and set it to false for app releases.

Q. I want to update the UI from a callback function.

A. When using callback functions and updating the UI, be cautious. If you call UI elements such as Toast directly within the asynchronously running NetFUNNEL callback, a java.lang.NullPointerException may occur.

Therefore, when using NetFUNNEL callback functions, use the Activity.runOnUiThread(Runnable) method to switch UI updates from an async thread to the main thread.

For example, you can safely perform all UI-related operations on the main thread as shown below:

activity.runOnUiThread {
Toast.makeText(activity, "Successfully entered.", Toast.LENGTH_SHORT).show()
}

Q. I get errors during HTTP communication.

A. The NetFUNNEL Android agent is recommended to use HTTPS communication by default. When using HTTP, Android security policies may cause errors. However, you can allow HTTP communication by creating a network_security_config.xml configuration file.

  1. Create the file res/xml/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">{{DOMAIN_URL}}</domain>
</domain-config>
</network-security-config>
  1. Check your AndroidManifest.xml configuration:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:networkSecurityConfig="@xml/network_security_config"
... >
</manifest>

Q. How can I check the agent version?

A. You can use the getVersion() function to check the agent version.

Function NameParameterReturn ValueDescription
getVersionN/AStringFunction that returns (checks) the NetFUNNEL agent version