-        long gatherTime = Preferences.getInstance(this).getGatherTime();
108
-        if(gatherTime<System.currentTimeMillis()){
109
-            mHandler.sendEmptyMessageDelayed(MSG_FETCH_TOUR_INFO,60000);
110
-        }
111
-    }
112 106
 
113 107
     private void fetchTourInfo(){
108
+        mHandler.removeMessages(MSG_FETCH_TOUR_INFO);
114 109
         mHandler.sendEmptyMessageDelayed(MSG_FETCH_TOUR_INFO,FETCH_GATHER_INFO_PERIOD);
115
-        if(!Preferences.getInstance(this).isTourMode()&&Preferences.getInstance(this).getTourEndTime()<System.currentTimeMillis()){
110
+        if(!Preferences.getInstance(this).isTourMode()){
111
+            LogHelper.d(TAG,"已经知道不是旅行模式,跳过此次集合信息请求");
116 112
             return;
117 113
         }
118 114
         long gatherTime = Preferences.getInstance(this).getGatherTime();
119
-        if(gatherTime>System.currentTimeMillis()){
115
+        if(Preferences.getInstance(this).isTourMode() && gatherTime>System.currentTimeMillis()){
116
+            LogHelper.d(TAG,"已经知道是旅行模式,且集合时间已得到,跳过此次集合信息请求");
120 117
             return;
121 118
         }
122 119
         if(fetchTourInfoTask!=null && fetchTourInfoTask.getStatus()== AsyncTask.Status.RUNNING){
123 120
             return;
124 121
         }
125
-        HashMap<String,String> params = new HashMap<String,String>();
122
+        LogHelper.d(TAG,"发起获取集合信息的网络请求");
123
+        HashMap<String,String> params = new HashMap<>();
126 124
         String userId = Preferences.getInstance(this).getUserId();
127 125
         if(userId.length()==0){
128 126
             return;
@@ -131,7 +129,6 @@ public class MyLocationService extends Service implements Handler.Callback{
131 129
 
132 130
         fetchTourInfoTask = new HttpPostTask(this,params) {
133 131
 
134
-
135 132
             @Override
136 133
             protected boolean parseResponse(Context context, String response) {
137 134
                 try{
@@ -146,7 +143,7 @@ public class MyLocationService extends Service implements Handler.Callback{
146 143
                             String phone = group.getString("phone");
147 144
                             Preferences.getInstance(context).setTourGuidePhone(phone);
148 145
                             String gatherTimeStr = group.getString("gather_at");
149
-                            Preferences.getInstance(context).setGatherTime(TimeUtils.getStandardTimeInMiliSec(gatherTimeStr));
146
+                            Preferences.getInstance(context).setGatherTime(TimeUtils.getStandardTimeInMiliSec(gatherTimeStr)+30*60*1000);
150 147
                             String endTimeStr = group.getString("ended_at");
151 148
                             Preferences.getInstance(context).setTourEndTime(TimeUtils.getStandardTimeInMiliSec(endTimeStr));
152 149
                             if(group.has("gather_location")){
@@ -202,7 +199,7 @@ public class MyLocationService extends Service implements Handler.Callback{
202 199
             }
203 200
             double lat = loc.getLatitude();
204 201
             double lon = loc.getLongitude();
205
-            LogHelper.dfile("czy","经纬度 lat = "+lat+"lon="+lon+" 位置 ="+loc.getAddress());
202
+            LogHelper.d(TAG,"上报经纬度 lat = "+lat+"lon="+lon+" 位置 ="+loc.getAddress());
206 203
             reportLocationWhenTourMode(lat,lon);
207 204
         }
208 205
     };
@@ -211,9 +208,11 @@ public class MyLocationService extends Service implements Handler.Callback{
211 208
     private void startLocation(){
212 209
         initLocation();
213 210
         if(Preferences.getInstance(this).isTourMode()){
211
+            LogHelper.d(TAG,"当前是旅行模式,开始定位");
214 212
             locationClient.setLocationOption(locationOption);
215 213
             locationClient.startLocation();
216 214
             if(Preferences.getInstance(this).getGatherTime()> System.currentTimeMillis()){
215
+                LogHelper.d(TAG,"当前是旅行模式,且存在集合时间,预约下一次定位");
217 216
                 mHandler.sendEmptyMessageDelayed(MSG_START_LOCATION,Preferences.getInstance(this)
218 217
                         .getGatherTime()-System.currentTimeMillis()>LOCATION_PERIOD_CHANGE_DEADLINE ? LOCATION_MAX_PERIOD:LOCATION_MIN_PERIOD);
219 218
             }
@@ -235,7 +234,7 @@ private void reportLocationWhenTourMode(double lat, double lon){
235 234
     if(locationClient!=null){
236 235
         locationClient.stopLocation();
237 236
     }
238
-    if(lat == lastLat && lon ==lastLon && repeatTime<5){
237
+    if(lat == lastLat && lon ==lastLon && repeatTime<2){
239 238
         repeatTime++;
240 239
         return;
241 240
     }

+ 1 - 1
build.gradle

@@ -4,7 +4,7 @@ buildscript {
4 4
         jcenter()
5 5
     }
6 6
     dependencies {
7
-        classpath 'com.android.tools.build:gradle:2.3.0'
7
+        classpath 'com.android.tools.build:gradle:2.3.1'
8 8
 
9 9
         // NOTE: Do not place your application dependencies here; they belong
10 10
         // in the individual module build.gradle files

kodo - Gogs: Go Git Service

Няма описание

huangqimin: 212f24c882 MarketCode преди 6 години
..
algorithm f38d3bf980 Caesar Alg преди 8 години
error 212f24c882 MarketCode преди 6 години
redis 211ab99a32 :art: member/user/coupon/detail & member/user/coupon/use преди 6 години
sql f3cf68f957 Add PAI2_HOME_WX_API for request.weixin преди 8 години
zbar 3d0d214667 :sparkles: Member Infos преди 6 години
__init__.py 52ce35cbfc add api uuid_init/uuid преди 10 години
admin_utils.py 9e4ac4fd3b Add admin_status for GroupUserInfo преди 9 години
disk_utils.py af2b3f483f change download.html to be generated from download.tmpl.html преди 10 години
group_photo_utils.py 0e7b5eb1af Update order_by of group session photos преди 9 години
message_utils.py 21b4a5403a add api lensman_brief_api преди 9 години
original_CGzC_10a50000c8811190.bak.jpg 290ff6960f pyzbar преди 6 години
original_CGzC_10a50000c8811190.jpg 680f424408 Update water mark преди 9 години
paiai_96_96.png 4a8b4f8819 add watermark преди 10 години
paiai_water_mark.png 680f424408 Update water mark преди 9 години
price_utils.py 24e345a32f Add price func get_group_photo_price преди 8 години
qiniucdn.py 4ce7f5c87b :art: Member Relative APIs преди 6 години
rdm_utils.py 4efb7f6f87 Statistic преди 8 години
storage_qiniu_utils.py f2fc73685d Update package django_xxx преди 8 години
storage_utils.py f2fc73685d Update package django_xxx преди 8 години
thumbnail_utils.py 5c9e21b29b add Only Once Function statistic_thumbnail_size to statistic thumbnail size преди 10 години
time_utils.py 511533855d Change oauth to use http преди 8 години
url_utils.py 135c21b40c from models_ext import BaseModelMixin, upload_file_url, upload_path преди 8 години
version_utils.py 13816e8774 Fix Bug: REQUEST преди 8 години
watermark_utils.py 5411626ebe Change watermark position преди 8 години
wx_utils.py 32a7d9ffa0 Update wx relative преди 8 години