SAMPLE JAVASCRIPT COMMANDS
PRINT A MESSAGE TO THE CONSOLE
console.log('Hello World!');
PRINT THE ENSIGHTEN GLOBAL DATA OBJECT (ANDROID LIBRARY 3.0.0+, SWIFT LIBRARY 2.0.0+)
The global data object was added in Android Library 3.0.0 and Swift Library 2.0.0 and contains a common interface for accessing global data objects across Android and iOS.
console.log(JSON.stringify(Bootstrapper.mobile.dataModel.global));
PRINT THE ENSIGHTEN GLOBAL PARAMS OBJECT
The global params object contains platform-specific global data in Android, iOS (Objective-C), and iOS (Swift) apps.
console.log(JSON.stringify(Bootstrapper.mobile.dataModel.params));
SAMPLE MOBILE CONFIGURATION FILES
PRINT TRACKED CLASSES AND METHODS IN REALTIME TO THE ENSIGHTEN CONSOLE (ANDROID)
The configuration file below prints to the Ensighten Console the class name and method name of events that fire as you use the app.
{
"classes":{
".*":{
"on.*":{
"rules":[
{
"id":1,
"enabled":"true",
"data":[
{
"opcode":"getInvTarget"
},
{
"opcode":"callMethod",
"arg1":"getClass",
"arg2":"na"
},
{
"opcode":"callMethod",
"arg1":"getName",
"arg2":"na"
},
{
"opcode":"setRegisterCV",
"value":"class"
},
{
"opcode":"getCallingMethodName"
},
{
"opcode":"callJSFunction",
"value":"console.log('@r:class@ -> @cv@');"
}
]
}
]
}
}
},
"persistentStoreEnabled":true,
"version":"default"
}
PRINT TRACKED CLASSES AND METHODS IN REALTIME TO LOGCAT (ANDROID)
The configuration file below prints to Logcat the class name and method name of all events that fire as you use the app.
{
"classes":{
".*":{
"on.*":{
"rules":[
{
"id":1,
"enabled":"true",
"data":[
{
"opcode":"getInvTarget"
},
{
"opcode":"callMethod",
"arg1":"getClass",
"arg2":"na"
},
{
"opcode":"callMethod",
"arg1":"getName",
"arg2":"na"
},
{
"opcode":"setRegisterCV",
"value":"prefix"
},
{
"opcode":"getCallingMethodName"
},
{
"opcode":"prepend",
"value":" -> "
},
{
"opcode":"setRegisterCV",
"value":"suffix"
},
{
"opcode":"setCurrentValue",
"value":"r:prefix"
},
{
"opcode":"callMethod",
"arg1":"concat",
"arg2":"java.lang.String",
"arg3":"r:suffix"
},
{
"opcode":"setRegisterCV",
"value":"debug"
},
{
"opcode":"callStaticMethod",
"arg1":"android.util.Log",
"arg2":"d",
"arg3":"java.lang.String,java.lang.String",
"arg4":"Ensighten",
"arg5":"r:debug"
}
]
}
]
}
}
},
"persistentStoreEnabled":true,
"version":"default"
}
ALLOW WEBVIEW INSPECTION (ANDROID)
The configuration file below allows the Ensighten Web View to be inspected using Chrome Developer Tools.
{
"classes":{
},
"swizzles":{
},
"methods":{
},
"notifications":{
},
"events":{
},
"init":[
{
"enabled":true,
"id":"init",
"data":[
{
"opcode":"callStaticMethod",
"arg1":"android.webkit.WebView",
"arg2":"setWebContentsDebuggingEnabled",
"arg3":"boolean",
"arg4":"true"
}
]
}
],
"freshness":1,
"refreshInterval":30,
"version":"default",
"persistentStoreEnabled":true
}
Comments
0 comments
Please sign in to leave a comment.