Google Play 서비스를 사용하면 전체 프로젝트는 여기에서 찾을 수 있습니다
@Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "connected!!");
Geofence cinemaFence = new Geofence.Builder()
.setRequestId(id) // some id for you
.setExpirationDuration(Geofence.NEVER_EXPIRE)
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER)
.setCircularRegion(mLatitude, mLongtitude, mRadius)
.build();
GeofencingRequest request = new GeofencingRequest.Builder()
.addGeofence(cinemaFence)
.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER)
.build();
// Now we create an intent that will be fired when the user enters the region
Intent intent = new Intent(mContext, UserTransitionIntentService.class);
intent.putExtra(UserTransitionIntentService.EXTRA_FEATURES, getFeaturesFlag());
PendingIntent pi = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
LocationServices.GeofencingApi.addGeofences(mGoogleApiClient, request, pi);
}
: 클라이언트가 당신이 이미 알고있는 좌표를 사용하여 알림을 설정할 수 있습니다 연결되어있을 때
private void setUpApi() {
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mGoogleApiClient.connect();
}
먼저 구글 API 클라이언트를 설정 https://github.com/alexstyl/Location-Reminder
안녕하세요, 마이크, 해결책있어? –