Commit 6f2c82a4 by cuiliang.shi

4.1获取实时定位

短信内容:【微尚信息】颐关爱下发指令:#1#
1 parent c8b0a846
...@@ -74,7 +74,21 @@ public class LocationService extends Service { ...@@ -74,7 +74,21 @@ public class LocationService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand"); Log.d(TAG, "onStartCommand");
isStartFromSms(intent); String begin = intent.getStringExtra("begin");
String req = intent.getStringExtra("request");
if (begin != null){
String end = intent.getStringExtra("end");
String frequency = intent.getStringExtra("frequency");
PreferencesUtil.getInstance(getApplicationContext())
.putInt(PreferencesUtil.HENG_FENG_BEGIN, Integer.parseInt(begin));
PreferencesUtil.getInstance(getApplicationContext())
.putInt(PreferencesUtil.HENG_FENG_END, Integer.parseInt(end));
PreferencesUtil.getInstance(getApplicationContext())
.putInt(PreferencesUtil.HENG_FENG_FREQUENCY, Integer.parseInt(frequency));
}
handleForegroundService(); handleForegroundService();
...@@ -84,7 +98,13 @@ public class LocationService extends Service { ...@@ -84,7 +98,13 @@ public class LocationService extends Service {
if (PhoneUtils.getSubId(this, PreferencesUtil.HENG_FENG_DEFAULT_SLOT) == SubscriptionManager.INVALID_SUBSCRIPTION_ID){ if (PhoneUtils.getSubId(this, PreferencesUtil.HENG_FENG_DEFAULT_SLOT) == SubscriptionManager.INVALID_SUBSCRIPTION_ID){
Toast.makeText(this, getResources().getString(R.string.location_service_failed_tips), Toast.LENGTH_SHORT).show(); Toast.makeText(this, getResources().getString(R.string.location_service_failed_tips), Toast.LENGTH_SHORT).show();
}else{ }else{
if (PreferencesUtil.getInstance(getApplicationContext()) if (req != null){
PreferencesUtil.getInstance(getApplicationContext())
.putBoolean(PreferencesUtil.HENG_FENG_IS_OEPN, true);
cancelPreviousAlarmService();
readyToReqLocation();
}else if (PreferencesUtil.getInstance(getApplicationContext())
.getBoolean(PreferencesUtil.HENG_FENG_IS_OEPN, false)) { .getBoolean(PreferencesUtil.HENG_FENG_IS_OEPN, false)) {
if (PhoneUtils.hengdaServiceAvailable(getApplicationContext())) { if (PhoneUtils.hengdaServiceAvailable(getApplicationContext())) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!