diff --git a/app/src/main/java/com/example/cosmosclient/services/CosmosBackgroundService.java b/app/src/main/java/com/example/cosmosclient/services/CosmosBackgroundService.java index 6565442..d6d0834 100644 --- a/app/src/main/java/com/example/cosmosclient/services/CosmosBackgroundService.java +++ b/app/src/main/java/com/example/cosmosclient/services/CosmosBackgroundService.java @@ -441,7 +441,7 @@ //notificationを作成 Notification notification = new Notification(groups.get(i).getRequestList().getRequests().get(j),groups.get(i),null); //指定したkey(業番)を持っているHashMapがなければ作成する。 - if(codeToNotification.get(groups.get(i).getRequestList().getRequests().get(j))==null){ + if(codeToNotification.get(groups.get(i).getRequestList().getRequests().get(j).getLocation())==null){ notifications.add(notification); codeToNotification.put(groups.get(i).getRequestList().getRequests().get(j).getLocation(),notifications); }else{ @@ -452,8 +452,12 @@ } } //cosmosから区画情報から取得 - int areaInfoId =(int)((NowLat+90)/0.1)+(int)((NowLon/0.1)*1800); - codeToFeature =cosmos.getAreaInfo(areaInfoId).getFeature(); + + CosmosLocation cosmosLocation = new CosmosLocation(); + cosmosLocation.setLatitude(NowLat); + cosmosLocation.setLongitude(NowLon); + int areaInfoId = cosmosLocation.hashCode(); + codeToFeature=cosmos.getAreaInfo(areaInfoId).getFeature(); //codeToFeatureの中の50m圏外Featureを削除していく。 //HashMapを順番に実行 for(HashMap.Entry> e : codeToFeature.entrySet()) {