diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..681f41a
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 37a7509..dfd2c79 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/app/src/main/java/com/example/cosmosclient/resources/ShopRest.java b/app/src/main/java/com/example/cosmosclient/resources/ShopRest.java
deleted file mode 100644
index 0d9a51c..0000000
--- a/app/src/main/java/com/example/cosmosclient/resources/ShopRest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.example.cosmosclient.resources;
-
-import com.example.cosmosclient.entities.Feature;
-
-import retrofit2.Call;
-import retrofit2.http.GET;
-import retrofit2.http.Query;
-
-public interface ShopRest {
-
- @GET("rest")
- Call ShopRequest(@Query("longitude") double longitude,
- @Query("latitude") double latitude,
- @Query("longitudeRange") double longitudeRange,
- @Query("latitudeRange") double latitudeRange,
- @Query("shop") int shop);
-}
diff --git a/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java b/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java
index 28b1dcf..bb78f17 100644
--- a/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java
+++ b/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java
@@ -8,25 +8,40 @@
import android.app.PendingIntent;
import android.content.Intent;
import android.content.Context;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
-import android.location.LocationProvider;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
+import android.widget.Toast;
import com.example.cosmosclient.R;
+import com.example.cosmosclient.app.Cosmos;
+import com.example.cosmosclient.entities.AreaInformation;
+import com.example.cosmosclient.entities.Feature;
+import com.example.cosmosclient.entities.SignupResponse;
+import com.example.cosmosclient.resources.LocationRest;
+import com.example.cosmosclient.views.GroupListActivity;
+import com.example.cosmosclient.views.SignupActivity;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+import retrofit2.Retrofit;
+import retrofit2.converter.jackson.JacksonConverterFactory;
public class CosomosBackgroundService extends IntentService implements LocationListener {
private Context context;
private LocationManager locationManager;
+ private Location LOC;
private static final int MinTime = 1000;/*最小時間間隔*/
private static final float MinDistance = 1;/*最小距離間隔*/
@@ -138,7 +153,45 @@
// Log.d("debug", "onLocationChanged");
Log.d("debug", "lat:" + location.getLatitude());
Log.d("debug", "lon:" + location.getLongitude());
+ LOC.setLatitude(location.getLatitude());
+ LOC.setLongitude(location.getLongitude());
+ if(LOC.hashCode() == 0){
+ //retrofitの処理
+ final Retrofit retrofit = new Retrofit.Builder()
+ .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/cosmos/rest/")
+ .addConverterFactory(JacksonConverterFactory.create())
+ .build();
+ //interfaceから実装を取得
+ final LocationRest LocationService = retrofit.create(LocationRest.class);
+ //API呼び出しのための値入力
+ Call call = LocationService.LocationService(LOC.getLatitude(),LOC.getLongitude());
+
+ //サーバからデータ受け取り
+ call.enqueue(new Callback() {
+ //成功時
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()) {
+ AreaInformation result = response.body();
+
+ //app/Cosmosに情報保存
+ Cosmos app = (Cosmos) getApplication();
+
+ } else {
+ //onFailureでキャッチできないエラー用
+
+ }
+ }
+
+ //失敗時
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ t.printStackTrace();
+
+ }
+ });
+ }
}
@Override