Commit a853552764dbdde927a3fc639c76cd581fc150a2
1 parent
b8051e56
1 修改用户使用时,地理围栏判断逻辑
Showing
2 changed files
with
9 additions
and
5 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -519,6 +519,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -519,6 +519,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 519 | public int onStartCommand(Intent intent, int flags, int startId) { | 519 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 520 | userId = CommonInfo.getUserId(getApplicationContext()); | 520 | userId = CommonInfo.getUserId(getApplicationContext()); |
| 521 | if (userId != null && !TextUtils.isEmpty(userId)) { | 521 | if (userId != null && !TextUtils.isEmpty(userId)) { |
| 522 | + StepUtil.initDataBase(getApplicationContext(), userId); | ||
| 522 | if (!EventBus.getDefault().isRegistered(this)) { | 523 | if (!EventBus.getDefault().isRegistered(this)) { |
| 523 | EventBus.getDefault().register(this); | 524 | EventBus.getDefault().register(this); |
| 524 | } | 525 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/StepUtil.java
| @@ -35,6 +35,14 @@ public class StepUtil { | @@ -35,6 +35,14 @@ public class StepUtil { | ||
| 35 | return UUID.randomUUID().toString().replace("-", ""); | 35 | return UUID.randomUUID().toString().replace("-", ""); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | + public static void initDataBase(Context context, String uid) { | ||
| 39 | + if (null == getUserStepData(context, uid)) { | ||
| 40 | + DbCore.init(context, dbName); | ||
| 41 | + UserStepEntity userStepEntity = new UserStepEntity(); | ||
| 42 | + userStepEntity.setUserId(uid); | ||
| 43 | + DbCore.getDaoSession().getUserStepEntityDao().insert(userStepEntity); | ||
| 44 | + } | ||
| 45 | + } | ||
| 38 | 46 | ||
| 39 | /** | 47 | /** |
| 40 | * 删除临时保存数据 | 48 | * 删除临时保存数据 |
| @@ -107,7 +115,6 @@ public class StepUtil { | @@ -107,7 +115,6 @@ public class StepUtil { | ||
| 107 | } | 115 | } |
| 108 | 116 | ||
| 109 | 117 | ||
| 110 | - | ||
| 111 | /** | 118 | /** |
| 112 | * 设置重要点 | 119 | * 设置重要点 |
| 113 | * | 120 | * |
| @@ -211,7 +218,6 @@ public class StepUtil { | @@ -211,7 +218,6 @@ public class StepUtil { | ||
| 211 | } | 218 | } |
| 212 | 219 | ||
| 213 | 220 | ||
| 214 | - | ||
| 215 | /** | 221 | /** |
| 216 | * 得到当前速度 | 222 | * 得到当前速度 |
| 217 | * | 223 | * |
| @@ -338,7 +344,6 @@ public class StepUtil { | @@ -338,7 +344,6 @@ public class StepUtil { | ||
| 338 | } | 344 | } |
| 339 | 345 | ||
| 340 | 346 | ||
| 341 | - | ||
| 342 | /** | 347 | /** |
| 343 | * 设置计步开始时间 | 348 | * 设置计步开始时间 |
| 344 | * | 349 | * |
| @@ -373,8 +378,6 @@ public class StepUtil { | @@ -373,8 +378,6 @@ public class StepUtil { | ||
| 373 | } | 378 | } |
| 374 | 379 | ||
| 375 | 380 | ||
| 376 | - | ||
| 377 | - | ||
| 378 | /** | 381 | /** |
| 379 | * 获取用户暂停次数 | 382 | * 获取用户暂停次数 |
| 380 | * | 383 | * |