Skip to content

Commit

Permalink
更新demo
Browse files Browse the repository at this point in the history
修改暴露接口跳转GPS设置界面,新增支持设置页面返回回调
  • Loading branch information
D10NGYANG committed Apr 15, 2019
1 parent aa7d1cf commit 77d116f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static com.dlong.rep.dlocationmanager.DLocationWhat.NO_LOCATIONMANAGER;
import static com.dlong.rep.dlocationmanager.DLocationWhat.NO_PROVIDER;
import static com.dlong.rep.dlocationmanager.DLocationWhat.ONLY_GPS_WORK;

public class MainActivity extends AppCompatActivity {
private Context mContext = this;
Expand All @@ -24,6 +25,8 @@ public class MainActivity extends AppCompatActivity {
private double mLat;
private double mLng;

private final static int GO_TO_GPS = 150;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -64,9 +67,13 @@ public void doClick(View view) {

break;
case NO_PROVIDER:
txt.setText("没有可用的定位提供器或尚未打开定位");
txt.setText("尚未打开定位");
// TODO: 2019/4/13 打开定位
DLocationTools.openGpsSettings(mContext);
DLocationTools.openGpsSettings(mContext, GO_TO_GPS);
break;
case ONLY_GPS_WORK:
// TODO: 2019/4/15 切换定位模式到【高精确度】或【节电】
DLocationTools.openGpsSettings(mContext, GO_TO_GPS);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
*/
public class DLocationTools {

/**
* 打开Gps设置界面
*/
public static void openGpsSettings(Context context) {
openGpsSettings(context, -1);
}

/**
* 打开Gps设置界面
*/
Expand Down

0 comments on commit 77d116f

Please sign in to comment.