Android Agent
Android
This document provides a guide to applying and integrating Surffy NetFUNNEL Agent in the Android OS (AOS) environment.
Installation
Add code where the NetFUNNEL service is required.
Apply the code recommended in this guide to the communication part of your user code, and you can use the Surffy service through external URL input.
Kotlin
Java
Netfunnel
This class manages the overall flow.
As it is made of a singleton, you can reuse it by setting only the information that has changed since the initial information input as a setter.
Property
Users must enter the properties below:
- AppName: The client's application name
- Activity: The current Activity that NetFUNNEL is to be applied
- Context: Context for getting device internal information (If it is null, it gets Activity's Context value.)
- TenantAPIURL: Tenant API server address
- TenantNFURL: Tenant NetFUNNEL server address
- eumURL: End User Monitoring server address
- SettingURL: Server address for NetFUNNEL setting
The TenantAPIURL, TenantNFURL properties can be entered from the console's AOS installation guide.
nfStart()
After registering all input properties and AgentInterface, calling the nfStart() method starts NetFUNNEL (Checking the queue).
After the NetFUNNEL action, you can record the next action in the onSuccess method of AgentInterface. AgentInterface will be explained later in detail.
AgentInterface
An interface that defines functionally for use by users.
In AgentInterface, functions are defined by overriding the following functions. If not defined, there is no action.
Method
- public void onSuccess() *required
- It defines the action after NetFUNNEL action. Put the actual working code in this part.
- public void onCancel()
- Defined to prepare for situations where actions such as cancellation occur during NetFUNNEL action.
Recommend not to insert the code that may affect the action from the next line that performs nfStart() method of NetFunnel class.
As all methods perform as callbacks, recommend not to use functions that can cause problems, such as Activity, for functions of AgentInterface.
WebView
Surffy-NetFUNNEL-Agent has a structure that the client within the WebView communicates with the server after showing the waiting room to the WebView.
EUM
If NetFUNNEL performs successfully, the user's EUM information starts to be collected, and when the NetFUNNEL ends, the collected information is sent to the server.
Requirements
The minimum required specifications are:
- JAVA: JDK 1.8 and above
- Android: Android Agent 23 (Marshmallow) and above
Function
- VWR (Virtual Waiting Room)
- EUM (End-User Monitoring)
Appendix
Anomaly Action Defense
No Internet connection
Add the defense logic that leads to the 'cancel' action when there is no internet connection.
Airplane mode
Sometimes bypass access (unauthorized access) is attempted through airplane mode. The defense against this is:
- If airplane mode is on, we stop the communication and proceed to AgentInterface's onCancel method to defend the main flow.
Go-back (cancel)
Sometimes bypass access (unauthorized access) is attempted through the go-back button or the cancel button. The defense against this is:
- If the cancel button is entered in the WebView, we stop the communication and proceed to onCancel method of AgentInterface to defend the main flow.
- If the go-back button is entered, we proceed to onCancel method of AgentInterface by using the onBackPressed listener to defend the main flow.
Fast iteration input
Events that NetFUNNEL performs (onClick, etc.) are the user's domain, and NetFUNNEL can be repeatedly called when inputting (touching) quickly and repeatedly according to the implemented logic.
- When the nfStart() function is called, the same service URL request is repeatedly checked for 1 second.
Add library
Download the aar file in the attached file and add it to the app unit gradle.
e.g. 'aar' file under 'libs' directory
implementation files('libs/surffy-agent_x.x.x.aar')
Response Status Code
Code | Description | note |
200(SUCCESS) | on success |
|
201(CONTUNUE) | on waiting |
|
300(BYPASS) | Regardless of the 200 code in the server, it permits to enter |
|
301(SERVERSIDE_BLOCK) | Blocked from the server |
|
302(SERVERSIDE_IP_BLOCK) | The IP is blocked on the server |
|
303(EXPRESS_NUMBER) | Regardless of the queue, it counts as Success immediately | |
499(USER_CANCEL) | The user cancels | The cancel button in the NetFUNNEL WebView UI |
500 | No service | Error code |
502(KEY_DONE) | The key has already expired | Error code |
505(KEY_NOT_EXISTS) | The key doesn't exist | Error code |
507(INVALID_KEY) | Wrong key | Error code |
513(LICENSE_OVER) | Expired license | |
905(ERROR_DATA) | Data error | |
908(ERROR_SERVICE) | NetFUNNEL server not working | |
999(ERROR_SYSTEM) | NetFUNNEL server not working | |
Library usage example
Connection communication example
🏄♂️ Any other questions or feedback on Surffy docs? E-mail us at support@stclab.com.