Initialization Option Reference
Complete reference for all NetFUNNEL Android Agent configuration options and parameters.
Table of Contents
- Required Parameters
- Network Settings
- Debugging Options
- Template Options
- Error Handling Options
- UI Configuration
- Advanced Options
Complete Initialization Example
Here's a complete example showing all available configuration options:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
networkTimeout = 3000,
retryCount = 0,
printLog = false,
errorBypass = false,
useNetfunnelTemplate = true,
userId = "user_67890",
useNetworkRecoveryMode = true,
statusBarStyle = null
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
"user_67890", // userId
true, // useNetworkRecoveryMode
null // statusBarStyle
);
Required Parameters
These parameters are mandatory for the agent to function properly.
| Parameter | Type | Description | Required | Example |
|---|---|---|---|---|
clientId | String | NetFUNNEL client ID | Yes | "{{CLIENT_ID}}" |
If clientId is missing, the agent runs in bypass mode, allowing direct access without a waiting room.
Network Settings
Control network behavior and timeouts for NetFUNNEL server communications.
| Parameter | Type | Required | Default | Range |
|---|---|---|---|---|
networkTimeout | Long | Optional | 3000 | 100–10000 |
retryCount | Int | Optional | 0 | 0–10 |
useNetworkRecoveryMode | Boolean | Optional | false | true/false |
networkTimeout
Maximum timeout duration for NetFUNNEL server API requests before considering them transient failures.
| Property | Value |
|---|---|
| Unit | milliseconds (ms) |
| Range | 100–10000 |
| Default | 3000 |
| Applies to | NetFUNNEL server endpoints only |
Behavior:
- No response within timeout → Transient Failure
- Immediate error response → No timeout wait
- Each retry uses the same timeout setting
Examples:
networkTimeout = 1000→ 1 second timeoutnetworkTimeout = 5000→ 5 second timeout
Important Notes:
- Too short values may cause normal requests to be treated as timeouts
- With
networkTimeout = 3000andretryCount = 3, maximum wait time is 12 seconds beforeonNetworkErrorcallback - Even if error response arrives in 35ms, retry will wait 2.965 seconds before next attempt
retryCount
Number of additional retry attempts for transient failures in NetFUNNEL server API calls.
| Property | Value |
|---|---|
| Range | 0–10 |
| Default | 0 |
| Formula | Total attempts = (setting value) + 1 |
| Applies to | NetFUNNEL server endpoints only |
Behavior:
- Transient Failure → triggers retry (if retry count > 0)
- Permanent Failure → all retry attempts exhausted
- Each retry respects the
networkTimeoutsetting
Examples:
retryCount = 0→ No retry (single attempt)retryCount = 1→ 1 initial + 1 retry (2 total attempts)retryCount = 2→ 1 initial + 2 retries (3 total attempts)
Important Notes:
- If request succeeds during retry, retry process stops immediately
- After all retry attempts are exhausted,
onNetworkErrorcallback is triggered - Each retry respects the
networkTimeoutsetting
useNetworkRecoveryMode
Prevents users from being kicked out of waiting rooms due to network issues. When enabled, users stay in their waiting state (modal or waiting room) even when network problems occur, and automatically resume when connectivity is restored.
| Property | Value |
|---|---|
| Default | false |
| Applies to | 5002 (entry check) requests only |
| Core Benefit | No interruption to waiting experience during network issues |
The Problem This Solves:
- Without recovery mode: Network failure → Error page/callback → User loses waiting position
- With recovery mode: Network failure → Stay in waiting → Auto-resume when network recovers
Behavior:
| Mode | 5002 (Entry Check) | User Experience |
|---|---|---|
true | Stay in waiting, auto-recover | No interruption |
false | Normal retry → Error handling | Error page/callback |
Recovery Scenarios:
- Quick recovery: Keep existing key/sequence (maintains queue position)
- Extended outage: Get new key/sequence (position may reset)
Important Notes:
useNetworkRecoveryMode = trueonly maintains waiting room during network failures while waiting- If network fails before waiting starts,
onNetworkErrorcallback is still triggered - This setting prevents users from losing their waiting position due to temporary network issues
Debugging Options
Enable debugging and logging features.
| Parameter | Type | Required | Default | Options |
|---|---|---|---|---|
printLog | Boolean | Optional | false | true/false |
printLog
Print NetFUNNEL logs to Logcat.
Usage:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
printLog = true // Enable debug logging
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
true, // printLog - Enable debug logging
false,// errorBypass
true, // useNetfunnelTemplate
null, // userId
false,// useNetworkRecoveryMode
null // statusBarStyle
);
Check logs in Logcat:
- Open Android Studio Logcat
- Filter by
package:mine NetFUNNEL - Look for NetFUNNEL log messages
Log Output:
- Initialization status
- Network request details
- Callback responses
- Error messages
- Key management events
Template Options
Control waiting room appearance and templates.
| Parameter | Type | Required | Default | Options |
|---|---|---|---|---|
useNetfunnelTemplate | Boolean | Optional | true | true/false |
useNetfunnelTemplate
Use the default NetFUNNEL waiting room template.
Options:
true(default): Uses NetFUNNEL's standard waiting room templatefalse: Allows custom waiting room template implementation
Custom Template Implementation:
When useNetfunnelTemplate = false, you must implement custom waiting room UI and handle the onContinue callback to receive real-time waiting information.
onContinue Callback Parameters:
| Parameter | Type | Description | Example |
|---|---|---|---|
statusCode | Int | Response code for waiting status | 201 |
message | String | Message for waiting status | "Continue" |
aheadWait | Int | Number of users ahead in queue | {{N}} |
behindWait | Int | Number of users behind in queue | {{N}} |
waitTime | String | Expected waiting time | {{HH:mm:ss}} |
progressRate | Int | Progress percentage | {{0~100}} |
Basic Custom Template Example:
private val callback = object : NetfunnelCallback() {
override fun onContinue(statusCode: Int, message: String, aheadWait: Int, behindWait: Int, waitTime: String, progressRate: Int) {
// Update your custom waiting room UI
updateCustomWaitingRoom(aheadWait, behindWait, waitTime, progressRate)
}
}
Complete Custom Dialog Implementation:
1. Initialize with Custom Template:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
useNetfunnelTemplate = false // Enable custom template
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
false,// useNetfunnelTemplate - Enable custom template
null, // userId
false,// useNetworkRecoveryMode
null // statusBarStyle
);
2. Custom Dialog XML Layout:
<!-- dialog_netfunnel.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog_rounded"
android:orientation="vertical"
android:padding="24dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Expected Wait Time"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_wait_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00:00"
android:textSize="28sp"
android:textStyle="bold" />
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="12dp"
android:progress="50" />
<TextView
android:id="@+id/txt_front_queue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Users ahead: 0"
android:textSize="15sp" />
<TextView
android:id="@+id/txt_behind_queue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Users behind: 0"
android:textSize="15sp" />
<Button
android:id="@+id/btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Close"
android:textSize="15sp" />
</LinearLayout>
3. Custom Dialog Controller:
class NetfunnelDialog(
context: Context,
private val onClose: () -> Unit
) : Dialog(context) {
private lateinit var binding: DialogNetfunnelBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DialogNetfunnelBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.btnCancel.setOnClickListener {
closeDialog()
}
}
private fun closeDialog() {
dismiss()
onClose() // Call Netfunnel.nfStop() to properly terminate waiting
}
fun updateDialog(aheadWait: Int, behindWait: Int, waitTime: String, progressRate: Int) {
"Users ahead: $aheadWait".also { binding.txtFrontQueue.text = it }
"Users behind: $behindWait".also { binding.txtBehindQueue.text = it }
binding.txtWaitTime.text = waitTime
binding.progressBar.progress = progressRate
}
}
4. Complete Callback Implementation:
private val callback = object : NetfunnelCallback() {
override fun onContinue(statusCode: Int, message: String, aheadWait: Int, behindWait: Int, waitTime: String, progressRate: Int) {
activity.runOnUiThread {
if (dialog == null) {
dialog = NetfunnelDialog(activity) {
Netfunnel.nfStop("{{PROJECT_KEY}}", "{{SEGMENT_KEY}}", stopCallback)
}.apply {
setCanceledOnTouchOutside(false)
show()
}
}
dialog?.updateDialog(aheadWait, behindWait, waitTime, progressRate)
}
}
override fun onSuccess(statusCode: Int, message: String) {
dialog?.dismiss()
dialog = null
// Navigate to main activity
}
override fun onError(statusCode: Int, message: String) {
dialog?.dismiss()
dialog = null
// Handle error
}
}
Important Notes:
- Dialog creation: Create dialog only once, then update UI with
updateDialog() - UI updates: Always use
runOnUiThreadfor UI modifications - Proper termination: Call
Netfunnel.nfStop()when closing dialog to return entry key - Limited functionality: Custom templates have restrictions on advanced waiting room features
- Recommendation: Use
useNetfunnelTemplate = truefor full functionality unless custom UI is required
Error Handling Options
Control how errors are handled and displayed to users.
| Parameter | Type | Required | Default | Options |
|---|---|---|---|---|
errorBypass | Boolean | Optional | false | true/false |
errorBypass
Treat Error/NetworkError as Success.
Behavior:
false(default): Normal error handling (callbacks/redirects on errors)true: Treats errors as success, allowing service to continue (bypass mode)
When errorBypass = true:
onErrorandonNetworkErrorcallbacks are not called- Instead,
onSuccesscallback is triggered - Only
onSuccesscallback needs to be implemented - All error situations are bypassed
Use Cases for errorBypass = true:
- Testing environments
- Services where network connectivity doesn't affect core functionality
- Simple event participation systems
- Development and debugging scenarios
Important Warning:
errorBypass = truebypasses all error situations- Use with caution as it may hide important network issues
- Not recommended for production environments with critical traffic control needs
Error Types Handled:
- Network errors (1001, 1002)
- Server errors (500)
- User cancellation (499)
- Invalid configuration errors
Code-based Integration Callbacks:
When errorBypass = false, the following callbacks are triggered:
onNetworkError: For network-related errors (1001, 1002)onError: For server errors (500)onClose: For user cancellation (499)
Network Error Callbacks
NetFUNNEL Android Agent provides detailed network error information through onNetworkError callback.
Network Error Types:
| Status Code | Message | Description |
|---|---|---|
| 1001 | Network Not Connected | Network connection blocked (WiFi/cellular data disabled) |
| 1002 | Network Timeout | Network response delay causing timeout |
Network Error Handling Example:
private val callback = object : NetfunnelCallback() {
override fun onNetworkError(statusCode: Int, message: String) {
when (statusCode) {
1001 -> {
// Network connection blocked - show immediate user guidance
showToast("네트워크 연결에 실패했습니다. 네트워크 설정을 확인해 주세요.", activity)
}
1002 -> {
// Network timeout - navigate to retry screen
navigateToNetworkErrorActivity(activity)
}
}
}
}
Error Handling Strategy:
- 1001 (Network Not Connected): Immediate user guidance (toast message, dialog)
- 1002 (Network Timeout): Navigate to error screen with retry option
UI Configuration
Control waiting room UI appearance and behavior.
| Parameter | Type | Required | Default | Options |
|---|---|---|---|---|
statusBarStyle | String? | Optional | null | null, "auto", "black", "white" |
statusBarStyle
Control status bar style and icon colors for NetFUNNEL waiting room (WebView).
Available Values:
| Value | Description | Behavior |
|---|---|---|
null (default) | Use app's default theme | Status bar remains visible, no FullScreen mode |
"auto" | Automatic icon color based on theme | Light mode: black icons, Dark mode: white icons |
"black" | Always black icons | Fixed black icon color regardless of theme |
"white" | Always white icons | Fixed white icon color regardless of theme |
Behavior Details:
Default Value (null):
- Follows app's default theme settings
- FullScreen mode is not applied
- Status bar remains visible as normal
Option Values ("auto", "black", "white"):
- FullScreen mode is automatically applied
- Status bar becomes transparent
- Icon colors are controlled based on the selected option
Usage Examples:
1. Default Behavior:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
statusBarStyle = null // Use app's default theme
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
null, // userId
false,// useNetworkRecoveryMode
null // statusBarStyle - Use app's default theme
);
2. Automatic Icon Color:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
statusBarStyle = "auto" // Auto-adjust icon color based on theme
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
null, // userId
false,// useNetworkRecoveryMode
"auto" // statusBarStyle - Auto-adjust icon color based on theme
);
3. Fixed Black Icons:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
statusBarStyle = "black" // Always black icons
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
null, // userId
false,// useNetworkRecoveryMode
"black" // statusBarStyle - Always black icons
);
4. Fixed White Icons:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
statusBarStyle = "white" // Always white icons
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
null, // userId
false,// useNetworkRecoveryMode
"white" // statusBarStyle - Always white icons
);
Important Notes:
- FullScreen Mode: When using any option value (
"auto","black","white"), FullScreen mode is automatically applied - Transparency: Status bar becomes transparent when option values are used
- Theme Compatibility:
"auto"option automatically adapts to light/dark themes - Icon Visibility: Choose appropriate icon color based on your waiting room background
For detailed information about status bar configuration options, see the Feature Guide - Waiting Room Status Bar Settings.
Advanced Options
Additional configuration options for advanced use cases.
| Parameter | Type | Required | Default | Options |
|---|---|---|---|---|
userId | String? | Optional | null | User identifier string |
userId
Set user identifier for whitelist/blacklist management.
Usage:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
userId = "user_67890" // User-specific identifier
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
3000, // networkTimeout
0, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
"user_67890", // userId - User-specific identifier
false,// useNetworkRecoveryMode
null // statusBarStyle
);
Use Cases:
- Whitelist specific users
- Blacklist problematic users
- User-specific traffic control
- Analytics and monitoring
Complete Example
Here's a complete initialization example with all options:
- Kotlin
- Java
Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
networkTimeout = 5000,
retryCount = 2,
printLog = false,
errorBypass = false,
useNetfunnelTemplate = true,
userId = "user_67890",
useNetworkRecoveryMode = true,
statusBarStyle = null
)
Netfunnel.INSTANCE.initialize(
"{{CLIENT_ID}}",
5000, // networkTimeout
2, // retryCount
false,// printLog
false,// errorBypass
true, // useNetfunnelTemplate
"user_67890", // userId
true, // useNetworkRecoveryMode
null // statusBarStyle
);
Related Documentation
- Installation & Initialization: Basic setup guide
- API Reference: Function specifications and callbacks
- Troubleshooting: Common issues and solutions
- Basic Control Integration: Implementation examples
- Section Control Integration: Implementation examples