2
我與Android Geofence Api混淆。所以該方法說.setTransitionTypes(int)。但是,當我嘗試設置地理圍欄來監視特定地理圍欄的進入和退出時,它只會監視我設置爲監視的Transition的過渡類型。地理柵欄與多個轉換類型設置 - Android
這裏是
public Geofence toGeofence() {
// Build a new Geofence object
return new Geofence.Builder()
.setRequestId(getId())
.setTransitionTypes(getTransitionType()) //Geofence.GEOFENCE_TRANSITION_ENTER
.setTransitionTypes(getTransitionType2())// Geofence.GEOFENCE_TRANSITION_EXIT
.setCircularRegion(
getLatitude(), getLongitude(), getRadius())
.setExpirationDuration(mExpirationDuration)
.build();}
這僅監視最後過渡型組其是出口過渡,我已經使出創建2個地理圍欄對於相同的區域,一個監視每個過渡的我的代碼的一個例子,但我覺得這是不行的路。任何幫助?