中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁 > 汽車電子 > 設(shè)計(jì)應(yīng)用 > 基于Android的位置實(shí)時(shí)監(jiān)控系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)

        基于Android的位置實(shí)時(shí)監(jiān)控系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)

        作者:張維文 孫耀杰 李利娟 時(shí)間:2015-04-23 來源:電子產(chǎn)品世界 收藏

          2.3 程序?qū)崿F(xiàn)

        本文引用地址:http://www.antipu.com.cn/article/273085.htm

          一是定位功能的實(shí)現(xiàn)。充分利用智能手機(jī)內(nèi)置定位模塊,基于Eclipse開發(fā)平臺通過程序的調(diào)用,實(shí)現(xiàn)定位功能,手機(jī)運(yùn)行結(jié)果如圖4所示。其實(shí)現(xiàn)代碼如下:

          /**
          * 將獲得的位置信息顯示出來
          * @param location
          */
          private void setLocation(Location location){
          if (location != null) {
          String latitudeStr = Double.toString(location.getLatitude());//經(jīng)度
          String longitudeStr = Double.toString(location.getLongitude());//緯度
          String altitudeStr = Double.toString(location.getAltitude());//海拔
          // 獲取當(dāng)前時(shí)間
          SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.CHINA);
          String dateStr = sDateFormat.format(new java.util.Date());
          gpsTime.setText(dateStr);
          if (latitudeStr != null && !latitudeStr.equals("")) {
          latitude.setText(latitudeStr);
          }
          if (longitudeStr != null && !longitudeStr.equals("")) {
          longitude.setText(longitudeStr);
          }
          if (altitudeStr != null && !altitudeStr.equals("")) {
          altitude.setText(altitudeStr);
          }
          } else {
          Log.v("location", "location為空");
          }
          }

          二是經(jīng)緯度信息發(fā)送功能的實(shí)現(xiàn)。根據(jù)事先設(shè)置好的監(jiān)控端手機(jī)號碼,按照發(fā)送頻率(時(shí)間間隔),將經(jīng)緯度發(fā)送到監(jiān)控端。其實(shí)現(xiàn)代碼如下:

          /**
          * 發(fā)送短信
          * @param smsContent 短信內(nèi)容
          */
          private void sendSMS(String smsContent){
          //獲取短信管理器
          SmsManager smsManager = SmsManager.getDefault();
          //拆分短信內(nèi)容
          List divideContents = smsManager.divideMessage(smsContent);
          if (curPhoneNum == null || curPhoneNum.equals("")) {
          new AlertDialog.Builder(MainActivity.this).setTitle("警告").setMessage("您還未設(shè)置目標(biāo)電話號碼").create().show();
          return;
          }
          //發(fā)送短信
          for (String text : divideContents) {
          smsManager.sendTextMessage(curPhoneNum, null, text, null, null);
          }
          }



        評論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉