Integrate SDK
Let's start coding in your Android project!
Initialize and Start EdgePulse
- Import the EdgePulse module at the top of your main file:
main.kt
import com.edge.pulse.EdgePulse
- Create a variable for EdgePulse that is accessible throughout the class:
main.kt
lateinit var edgePulse: EdgePulse
- Initialize EdgePulse in your
onCreate
orinit
function, providing the application context and your access token:main.ktedgePulse = EdgePulse(context, "<YOUR_ACCESS_TOKEN>")
- Before starting EdgePulse, request the necessary location permissions from the user programmatically. For example:
main.kt
val permissions = arrayOf(
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.ACCESS_COARSE_LOCATION,
android.Manifest.permission.ACCESS_BACKGROUND_LOCATION
)
ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE_LOCATION)
`` - Once EdgePulse is initialized and permissions are granted, start the SDK tracking:
main.kt
edgePulse.start()