【问题标题】:Sending GPS & Google Maps link through SMS通过 SMS 发送 GPS 和 Google 地图链接
【发布时间】:2017-08-07 01:36:43
【问题描述】:

您好,我已完成所有权限,并且我的 SMS 消息工作正常,并从模拟器发送文本。但是,我正在尝试发送带有特定坐标(经度、纬度)的链接,该坐标将用户坐标发送到 Google 地图的链接中。我正在努力将谷歌地图链接和坐标传递到一个字符串中。任何帮助都会很棒,这就是我所拥有的:

 btnGetLocation.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GPSTracker gpsT = new GPSTracker(getApplicationContext());
                Location l = gpsT.getLocation();
                if (l != null) {
                    double lat = l.getLatitude();
                    double lon = l.getLongitude();
                    Toast.makeText(getApplicationContext(), "Lat: " + lat + "\n Long: " + lon,
                            Toast.LENGTH_LONG).show();
                    SmsManager smsManager = SmsManager.getDefault();

                    smsManager.sendTextMessage(myCarerDB.getCarerNumber(), null,
                            "Hi I am here.. http://www.google.com/maps/place/lat,lon ", null, null);
                }
            }
        });

【问题讨论】:

    标签: android gps sms


    【解决方案1】:

    您必须通过将 lat long 附加到字符串末尾来建立链接。 这可以像

    smsManager.sendTextMessage(myCarerDB.getCarerNumber(), null, 
    "Hi I am here.. http://www.google.com/maps/place/"+lat+","+long, null, null);
    

    【讨论】:

      猜你喜欢
      • 2013-03-25
      • 1970-01-01
      • 2018-08-08
      • 2017-10-18
      • 1970-01-01
      • 1970-01-01
      • 2018-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多