最近我需要修改一个程序以添加一些新功能。该程序用于收集手机周围的信息并将其发送到用户定义的服务器或将数据存储在 SD 卡上。但是如果我们不自己设置服务器主机,app运行时会每5秒显示一次toast localhost/127.0.0.1:5001 – Connection refused
:.
有谁知道我怎么知道这个吐司来自哪里?由于代码中有很多地方,我们有一个toast.show()
.
提前致谢!
这是可能导致问题的代码片段。
/**
* Update GPS Status
*/
public void updateGpsStatus(Context context, Handler handler) {
try {
LocationManager locationManager = (LocationManager) context
.getSystemService(Context.LOCATION_SERVICE);
this.gpsStatus = locationManager
.isProviderEnabled(LocationManager.GPS_PROVIDER);
} catch (Exception e) {
if (handler == null) {
ComFunc.showToast(context, e.getMessage());
} else {
ComFunc.showToast(context, e.getMessage(), handler);
}
e.printStackTrace();
}
}