I tracked my problem down to adding to my geofenceList.
this is a global variable
lateinit var geofenceList: MutableList<Geofence>
In onCreate
I add to the list:
val latitude = -26.082586
val longitude = 27.777242
val radius = 10f
geofenceList.add(Geofence.Builder()
.setRequestId("Toets")
.setCircularRegion(latitude,longitude,radius)
.setExpirationDuration(Geofence.NEVER_EXPIRE)
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER)
.build())
Every time I run the app the app closes as soon as it opens.
I tried changing it to a normal variable but I am not certain how to do it and keep it a global variable, and a List would be more useful.