Code example for Service

Methods: getSystemService

0
	public ThreeGLogger(String logFileName, int interval, Service s) {
		super(logFileName, interval);
		m_service = s;
		m_ss = -1;
		m_myListener = new MyPhoneStateListener();
		m_telManager = (TelephonyManager)m_service.getSystemService(Context.TELEPHONY_SERVICE);
		m_telManager.listen(m_myListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
	} 
 
	@Override 
	public String getLogValue() {
		List<NeighboringCellInfo> n_cinfo = m_telManager.getNeighboringCellInfo();
		String cinfos = "Neighbors: " + n_cinfo.size();
		for(NeighboringCellInfo n : n_cinfo)
		{ 
			cinfos += " " + n.getCid() + " " + n.getLac() + " " + n.getRssi(); 
		} 
		GsmCellLocation gcl = ((GsmCellLocation)m_telManager.getCellLocation());
		String rstr = "" + getNetworkTypeStr(m_telManager.getNetworkType()) + " " + getDataStateStr(m_telManager.getDataState()) + " " + getDataActivityStr(m_telManager.getDataActivity())+ " " + m_ss 
		+ " " + gcl.getCid() + " " + gcl.getLac() + cinfos; //FIXME GSM_ONLY method, get cell_id and Location_area_code
		return rstr;