JSONHelper.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:localcloud_fe 作者:
/**
 * Parses data from PhoneStateListener.LISTEN_CELL_LOCATION.onCellLocationChanged
 * http://developer.android.com/reference/android/telephony/cdma/CdmaCellLocation.html
 * @param location GsmCellLocation
 * @return JSON
 */
public static String gsmCellLocationJSON(GsmCellLocation location){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if(location != null){
        try {
            json.put("provider", CELLLOCATION_PROVIDER);
            json.put("type", GSM);
            json.put("timestamp", calendar.getTimeInMillis());
            json.put("cid", location.getCid());
            json.put("lac", location.getLac());
            json.put("psc", location.getPsc());
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }

    return json.toString();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号