Java Code Examples for com.google.android.gms.location.GeofenceStatusCodes#GEOFENCE_NOT_AVAILABLE
The following examples show how to use
com.google.android.gms.location.GeofenceStatusCodes#GEOFENCE_NOT_AVAILABLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeofenceErrorMessages.java From react-native-boundary with Apache License 2.0 | 5 votes |
/** * Returns the error string for a geofencing error code. */ public static String getErrorString(int errorCode) { switch (errorCode) { case GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE: return "Geofence is not available"; case GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES: return "Too many geofences"; case GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS: return "Too many pending intents"; default: return "Unknown error: " + Integer.toString(errorCode); } }
Example 2
Source File: GeoTransitionHelper.java From mobile-messaging-sdk-android with Apache License 2.0 | 5 votes |
/** * Resolves transition information from geofencing intent * * @param intent geofencing intent * @return transition information * @throws RuntimeException if information cannot be resolved */ static GeoTransition resolveTransitionFromIntent(Intent intent) throws RuntimeException { GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent); if (geofencingEvent == null) { throw new RuntimeException("Geofencing event is null, cannot process"); } if (geofencingEvent.hasError()) { if (geofencingEvent.getErrorCode() == GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE) { throw new GeofenceNotAvailableException(); } throw new RuntimeException("ERROR: " + GeofenceStatusCodes.getStatusCodeString(geofencingEvent.getErrorCode())); } GeoEventType event = supportedTransitionEvents.get(geofencingEvent.getGeofenceTransition()); if (event == null) { throw new RuntimeException("Transition is not supported: " + geofencingEvent.getGeofenceTransition()); } Set<String> triggeringRequestIds = new ArraySet<>(); for (Geofence geofence : geofencingEvent.getTriggeringGeofences()) { triggeringRequestIds.add(geofence.getRequestId()); } Location location = geofencingEvent.getTriggeringLocation(); return new GeoTransition(event, triggeringRequestIds, new GeoLatLng(location.getLatitude(), location.getLongitude())); }
Example 3
Source File: GeofenceErrorMessages.java From io2015-codelabs with Apache License 2.0 | 5 votes |
public static String getErrorString(Context context, int errorCode) { Resources mResources = context.getResources(); switch (errorCode) { case GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE: return "Geofence service is not available now."; case GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES: return "Your app has registered too many geofences."; case GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS: return "You have provided too many PendingIntents!"; default: return "Unknown error."; } }
Example 4
Source File: GeofenceErrorMessages.java From io2015-codelabs with Apache License 2.0 | 5 votes |
public static String getErrorString(Context context, int errorCode) { Resources mResources = context.getResources(); switch (errorCode) { case GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE: return "Geofence service is not available now."; case GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES: return "Your app has registered too many geofences."; case GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS: return "You have provided too many PendingIntents!"; default: return "Unknown error."; } }
Example 5
Source File: GeofenceErrorMessages.java From location-samples with Apache License 2.0 | 5 votes |
/** * Returns the error string for a geofencing error code. */ public static String getErrorString(Context context, int errorCode) { Resources mResources = context.getResources(); switch (errorCode) { case GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE: return mResources.getString(R.string.geofence_not_available); case GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES: return mResources.getString(R.string.geofence_too_many_geofences); case GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS: return mResources.getString(R.string.geofence_too_many_pending_intents); default: return mResources.getString(R.string.unknown_geofence_error); } }