最近、いくつかの新しい機能を追加するために、1 つのプログラムを変更する必要があります。このプログラムは、モバイル周辺の情報を収集し、ユーザーが定義したサーバーに送信したり、SD カードにデータを保存したりするために使用されます。ただし、サーバー ホストを自分で設定しない場合、アプリは実行時に 5 秒ごとにトーストを表示します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();
}
}