gpt4 book ai didi

android - 为什么 GPS_PROVIDER isProviderEnabled 的检查总是 "false"?

转载 作者:太空宇宙 更新时间:2023-11-03 11:55:23 26 4
gpt4 key购买 nike

<分区>

我无法确定 GPS 是打开还是关闭,isProviderEnabled 始终为“false”但 GPS 已打开。

public abstract class BaseGPSActivity extends AppCompatActivity{

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Log.v(TAG, " GPS is enabled: "+isGPSEnabled()))

 public boolean isGPSEnabled(){
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if(provider != null)
Log.v(TAG, " Location providers: "+provider);
return mLocationManager!=null && mLocationManager.isProviderEnabled( LocationManager.GPS_PROVIDER );
}

输出是:

V/BaseGPSActivity:  Location providers: network

V/BaseGPSActivity: GPS is enabled: false

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com