Java 类com.google.android.gms.location.internal.ParcelableGeofence 实例源码

项目:android_external_GmsApi    文件:GeofencingEvent.java   
/**
 * Creates a {@link GeofencingEvent} object from the given intent.
 *
 * @param intent the intent to extract the geofencing event data from
 * @return a {@link GeofencingEvent} object or {@code null} if the given intent is {@code null}
 */
public static GeofencingEvent fromIntent(Intent intent) {
    if (intent == null) {
        return null;
    }
    GeofencingEvent event = new GeofencingEvent();
    event.errorCode = intent.getIntExtra(EXTRA_ERROR_CODE, -1);
    event.geofenceTransition = intent.getIntExtra(EXTRA_TRANSITION, -1);
    if (event.geofenceTransition != 1 && event.geofenceTransition != 2 && event.geofenceTransition != 4)
        event.geofenceTransition = -1;
    ArrayList<byte[]> parceledGeofences = (ArrayList<byte[]>) intent.getSerializableExtra(EXTRA_GEOFENCE_LIST);
    if (parceledGeofences != null) {
        event.triggeringGeofences = new ArrayList<Geofence>();
        for (byte[] parceledGeofence : parceledGeofences) {
            event.triggeringGeofences.add(SafeParcelUtil.fromByteArray(parceledGeofence, ParcelableGeofence.CREATOR));
        }
    }
    event.triggeringLocation = intent.getParcelableExtra(EXTRA_TRIGGERING_LOCATION);
    return event;
}
项目:android_external_GmsApi    文件:Geofence.java   
/**
 * Creates a geofence object.
 *
 * @throws IllegalArgumentException if any parameters are not set or out of range
 */
public Geofence build() throws IllegalArgumentException {
    if (requestId == null) {
        throw new IllegalArgumentException("Request ID not set.");
    } else if (transitionTypes == 0) {
        throw new IllegalArgumentException("Transition types not set.");
    } else if ((transitionTypes & GEOFENCE_TRANSITION_DWELL) > 0 && loiteringDelay < 0) {
        throw new IllegalArgumentException("Non-negative loitering delay needs to be set when transition types include GEOFENCE_TRANSITION_DWELLING.");
    } else if (expirationTime == Long.MIN_VALUE) {
        throw new IllegalArgumentException("Expiration not set.");
    } else if (regionType == -1) {
        throw new IllegalArgumentException("Geofence region not set.");
    } else if (notificationResponsiveness < 0) {
        throw new IllegalArgumentException("Notification responsiveness should be nonnegative.");
    } else {
        return new ParcelableGeofence(requestId, expirationTime, regionType, latitude, longitude, radius, transitionTypes, notificationResponsiveness, loiteringDelay);
    }
}
项目:android_external_GmsLib    文件:NativeLocationClientImpl.java   
public void addGeofences(List<ParcelableGeofence> geofences, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
    Log.d(TAG, "addGeofences(List<ParcelableGeofence>)");
    Intent i = new Intent(context, NativePendingIntentForwarder.class);
    Bundle bundle = new Bundle();
    bundle.putParcelable(EXTRA_PENDING_INTENT, pendingIntent);
    i.putExtras(bundle);
    nativePendingMap.put(pendingIntent, PendingIntent.getActivity(context, 0, i, 0));
    List<String> requestIds = new ArrayList<String>();
    for (ParcelableGeofence geofence : geofences) {
        locationManager.addProximityAlert(geofence.latitude, geofence.longitude, geofence.radius,
                geofence.expirationTime - SystemClock.elapsedRealtime(), nativePendingMap.get(pendingIntent));
        requestIds.add(geofence.getRequestId());
    }
    callbacks.onAddGeofenceResult(CommonStatusCodes.SUCCESS, requestIds.toArray(new String[requestIds.size()]));
}
项目:android_external_GmsLib    文件:LocationClientImpl.java   
public void addGeofences(List<ParcelableGeofence> request, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
    if (nativeLocation != null) {
        nativeLocation.addGeofences(request, pendingIntent, callbacks);
    } else {
        getServiceInterface().addGeofencesList(request, pendingIntent, callbacks, getContext().getPackageName());
    }
}
项目:FMTech    文件:GeofencingRequest.java   
public GeofencingRequest(int paramInt1, List<ParcelableGeofence> paramList, int paramInt2)
{
  this.a = paramInt1;
  this.b = paramList;
  this.c = paramInt2;
}
项目:android_packages_apps_GmsCore    文件:GoogleLocationManagerServiceImpl.java   
@Override
public void addGeofencesList(List<ParcelableGeofence> geofences, PendingIntent pendingIntent,
                             IGeofencerCallbacks callbacks, String packageName) throws RemoteException {
    Log.d(TAG, "addGeofencesList: " + geofences);
}
项目:FMTech    文件:fcs.java   
public abstract void a(List<ParcelableGeofence> paramList, PendingIntent paramPendingIntent, fcp paramfcp, String paramString);