Geofence error logging in shared_preferences

merge-requests/236/head
Zohaib Kambrani 5 years ago
parent a11d93332d
commit 187d2bcd8b

@ -4,6 +4,7 @@ package com.cloud.diplomaticquarterapp.geofence.intent_receivers
import android.content.Context
import com.cloud.diplomaticquarterapp.R
import com.cloud.diplomaticquarterapp.utils.saveLog
import com.google.android.gms.common.api.ApiException
import com.google.android.gms.location.GeofenceStatusCodes
@ -18,7 +19,7 @@ object GeofenceErrorMessages {
fun getErrorString(context: Context, errorCode: Int): String {
val resources = context.resources
return when (errorCode) {
val errorMessage = when (errorCode) {
GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE ->
resources.getString(R.string.geofence_not_available)
@ -28,7 +29,17 @@ object GeofenceErrorMessages {
GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS ->
resources.getString(R.string.geofence_too_many_pending_intents)
GeofenceStatusCodes.GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION ->
resources.getString(R.string.GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION)
GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT ->
resources.getString(R.string.GEOFENCE_REQUEST_TOO_FREQUENT)
else -> resources.getString(R.string.geofence_unknown_error)
}
saveLog(context,"GeofenceErrorMessages","$errorCode | $errorMessage")
return errorMessage
}
}

@ -13,4 +13,10 @@
<string name="geofence_too_many_pending_intents">
You have provided too many PendingIntents to the addGeofences() call.
</string>
<string name="GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION">
App do not have permission to access location service.
</string>
<string name="GEOFENCE_REQUEST_TOO_FREQUENT">
Geofence requests happened too frequently.
</string>
</resources>

Loading…
Cancel
Save