안드로이드 geofence 관련 질문드립니다.
조회수 922회
똑같은 앱을 두 기기에 설치해주고 한 기기에서 geofence를 만들면 다른 기기에서는 만들어진 geofence 안에 들어갔는지 확인이 되는 건가요?
코드는 아래와 같은데 '//noticication' 이 있는 부분에서 확인이 되어야 하는게 맞는 건가요? 아니라면 한 기기에서 geofence를 등록하면 다른기기에서 등록된 범위에 들어가면 확인하게 하려면어떠한 방법을 써야할까요?
protected void onHandleIntent(Intent intent) { GeofencingEvent event = GeofencingEvent.fromIntent(intent);
List<Geofence> triggeringGeofences = event.getTriggeringGeofences();
ArrayList triggeringGeofencesIdsList = new ArrayList();
for (Geofence geofence : triggeringGeofences)
triggeringGeofencesIdsList.add(geofence.getRequestId());
String IDs = TextUtils.join(", ", triggeringGeofencesIdsList);
int transitiontype = event.getGeofenceTransition();
if (transitiontype == Geofence.GEOFENCE_TRANSITION_ENTER) {
//notification
}
if (transitiontype == Geofence.GEOFENCE_TRANSITION_EXIT) {
Log.i("haha", "Exit from " + IDs);
Toast.makeText(this, "Exit from" + IDs, Toast.LENGTH_LONG).show();
}
}
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력