android10TYPE_PHONE,Java TelephonyManager.PHONE_TYPE_GSM属性代码示例

/**

* Description: Add entries to the "DBi_measure" DB table

*

* Issues:

* [ ]

*

* Notes: (a)

*

*

* TODO: Remove OLD notes below, once we have new ones relevant to our new table

*

* From "locationinfo":

*

* $ sqlite3.exe -header aimsicd.db 'select * from locationinfo;'

* _id|Lac|CellID|Net|Lat|Lng|Signal|Connection|Timestamp

* 1|10401|6828xxx|10|54.67874392|25.28693531|24|[10401,6828320,126]No|Di|HSPA||2015-01-21 20:45:10

*

* From "cellinfo":

*

* $ sqlite3.exe -header aimsicd.db 'select * from cellinfo;'

* _id|Lac|CellID|Net|Lat|Lng|Signal|Mcc|Mnc|Accuracy|Speed|Direction|NetworkType|MeasurementTaken|OCID_SUBMITTED|Timestamp

* 1|10401|6828xxx|10|54.67874392|25.28693531|24|246|2|69.0|0.0|0.0|HSPA|82964|0|2015-01-21 20:45:10

*

* Issues:

*

*/

public void onLocationChanged(Location loc) {

DeviceApi18.loadCellInfo(tm, mDevice);

if (!mDevice.mCell.isValid()) {

CellLocation cellLocation = tm.getCellLocation();

if (cellLocation != null) {

switch (mDevice.getPhoneID()) {

case TelephonyManager.PHONE_TYPE_NONE:

case TelephonyManager.PHONE_TYPE_SIP:

case TelephonyManager.PHONE_TYPE_GSM:

GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;

mDevice.mCell.setCID(gsmCellLocation.getCid()); // CID

mDevice.mCell.setLAC(gsmCellLocation.getLac()); // LAC

mDevice.mCell.setPSC(gsmCellLocation.getPsc()); // PSC

break;

case TelephonyManager.PHONE_TYPE_CDMA:

CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;

mDevice.mCell.setCID(cdmaCellLocation.getBaseStationId()); // BSID ??

mDevice.mCell.setLAC(cdmaCellLocation.getNetworkId()); // NID

mDevice.mCell.setSID(cdmaCellLocation.getSystemId()); // SID

mDevice.mCell.setMNC(cdmaCellLocation.getSystemId()); // MNC <== BUG!??

break;

}

}

}

if (loc != null && (Double.doubleToRawLongBits(loc.getLatitude()) != 0 && Double.doubleToRawLongBits(loc.getLongitude()) != 0)) {

mDevice.mCell.setLon(loc.getLongitude()); // gpsd_lon

mDevice.mCell.setLat(loc.getLatitude()); // gpsd_lat

mDevice.mCell.setSpeed(loc.getSpeed()); // speed // TODO: Remove, we're not using it!

mDevice.mCell.setAccuracy(loc.getAccuracy()); // gpsd_accu

mDevice.mCell.setBearing(loc.getBearing()); // -- [deg]?? // TODO: Remove, we're not using it!

mDevice.setLastLocation(loc); //

// Store last known location in preference

SharedPreferences.Editor prefsEditor;

prefsEditor = prefs.edit();

prefsEditor.putString(context.getString(R.string.data_last_lat_lon),

String.valueOf(loc.getLatitude()) + ":" + String.valueOf(loc.getLongitude()));

prefsEditor.apply();

// This only logs a BTS if we have GPS lock

// Test: ~~Is correct behaviour? We should consider logging all cells, even without GPS.~~

//if (mTrackingCell) {

// This also checks that the lac are cid are not in DB before inserting

dbHelper.insertBTS(mDevice.mCell);

//}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值