Sense is a device intelligence and identification tool. This tool collects a comprehensive set of attributes unique to a device or browser, forming an identity that will help businesses.
* iOS 12.0 or above
* Swift version 5.0 and above
pod 'SenseSDK', '~> 0.0.5'
pod update
import SenseSDK
To initialize the SDK add the below line of code with the public key you retrieved from Sense client panel. If you don't have a public key create new one and call that below function.
func initiateSense(){
let senseConfig = SenseConfig()
senseConfig.apiKey = "Your Unique Public API Key"
senseConfig.senseInfo = false // true or false
senseConfig.allowGeoLocation = false // true or false
senseConfig.tag = "" // String whatever you need like Home
senseConfig.sessionId = "" //Optional used for Workflow
senseConfig.metaInfo = [
"phone": "9xxxxxxxxx",
"name": "xxxxxxxxxxx"
] // A collection of key-value pairs intended for storing supplementary data related to the request. The set supports up to 15 pairs, with each key and value limited to a maximum of 256 characters.
Sense.initSDK(senseConfig: senseConfig, withDelegate: self)
}
If you pass senseInfo as true in above config means, it will return addtional Information like Request ID, First seen, Last seen, IP Address with SenseID. Otherwise it will return only SenseID and Request .
If you pass allowGeoLocation as true in above config means, it will return Device Location Information in Sense Details via our Server API.
Use the below code to obtain the Device result.
extension ViewController: SenseDelegate{
func onFailure(message: String) {
// Failure Callback.
}
func onSuccess(data: [String : Any]) {
// Success Callback
}
}
By call the following delegate to receive the device info shown below.
Sense.getSenseDetails(withDelegate: self)
You have to add this permission in Info.plist to get Device Location Information.
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to your location to provide location-based services.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location access is required for enhanced app functionality.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Require to get user location</string>
You have to add this permission in Info.plist to get Remote Access and Meeting Applications.
<!-- Remote Access Apps -->
<string>tvcontrol1</string> <!-- TeamViewer -->
<string>anydesk</string> <!-- AnyDesk -->
<string>rustdesk</string> <!-- RustDesk -->
<!-- Meeting Apps -->
<string>zoommtg</string> <!-- Zoom -->
<string>msteams</string> <!-- Microsoft Teams -->
<string>slack</string> <!-- Slack -->
<string>skype</string> <!-- Skype -->
Step 6 - If you need to know Installed Applications in our SDK, kindly update your Info.plist like below. You can add those apps that you need to check whether it's installed or not.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
<string>tez</string>
<string>phonepe</string>
<string>cred</string>
<string>amazon</string>
</array>
To get Behaviour Data for Keystrokes, Mouse Movements, Scroll Metrics, Touch Metrics, you can add the below methods to initialize it.
@IBOutlet weak var txtUsername: UITextField
@IBOutlet weak var txtPassword: UITextField
Sense.initKeyStrokeBehaviour(for: [txtUsername, txtPassword]);
@IBOutlet weak var scrollView: UIScrollView
Sense.initScrollBehaviour(for: [scrollView]);
Sense.initTouchBehaviour(for: self.view)
Sense.getBehaviourData(withDelegate: self)
extension ViewController: SenseBehaviourDelegate{
func onFailureBehaviour(message: String) {
print("Failure data")
}
func onSuccessBehaviour(data: String) {
print("Success data")
}
}