我只是想做如果 gsm 位置更新,写入 cellid
数据库。为了这个愿望,我尝试实现服务类,如下所示。问题我应该怎么做才能自动检测到gsm位置并编写函数即C(),工作是将cellid写入数据库被调用?
我的开始工作;
public class GpsCell extends Service{
TelephonyManager tel;
@Override
public void onCreate() {
super.onCreate();
tel = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation location = (GsmCellLocation)telephonyManager.getCellLocation();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Toast.makeText(this, "service starting", Toast.LENGTH_SHORT).show();
return super.onStartCommand(intent, flags, startId);
}