これは時代遅れかもしれませんが、エラーが何であるか分かりますか?
「セルの位置情報を取得中にエラーが発生しました」というエラーが表示されます。
このエラーにつながるソース コードを見つけました。
private void requestRefLocation(int flags)
{
TelephonyManager phone = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
if (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM)
{
GsmCellLocation gsm_cell = (GsmCellLocation) phone.getCellLocation();
if ((gsm_cell != null)
&& (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM)
&& (phone.getNetworkOperator() != null)
&& (phone.getNetworkOperator().length() > 3))
{
int type;
int mcc = Integer.parseInt(phone.getNetworkOperator().substring(0, 3));
int mnc = Integer.parseInt(phone.getNetworkOperator().substring(3));
int networkType = phone.getNetworkType();
if (networkType == TelephonyManager.NETWORK_TYPE_UMTS
|| networkType == TelephonyManager.NETWORK_TYPE_HSDPA
|| networkType == TelephonyManager.NETWORK_TYPE_HSUPA
|| networkType == TelephonyManager.NETWORK_TYPE_HSPA)
{
type = AGPS_REF_LOCATION_TYPE_UMTS_CELLID;
}
else
{
type = AGPS_REF_LOCATION_TYPE_GSM_CELLID;
}
native_agps_set_ref_location_cellid(type, mcc, mnc, gsm_cell.getLac(), gsm_cell.getCid());
}
else
{
Log.e(TAG, "Error getting cell location info.");
}
} else {
Log.e(TAG, "CDMA not supported.");
}
}
チェックステートメントに注意してください
if ((gsm_cell != null)
&& (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM)
&& (phone.getNetworkOperator() != null)
&& (phone.getNetworkOperator().length() > 3))
{
それはどういうわけかあなたが直面している問題につながります。もちろん、WIFI ネットワークに接続することで、別の方法で位置情報を取得できるため、位置情報を取得できます。これがあなたの質問に答えることを願っています。