ANDROID How to pass data (like Latitude and Longitude from GPS) to a SMS process, and send it

安稳与你 提交于 2019-12-12 19:57:16

问题


I have a class in getting latitude and longitude, and another one in receiving an SMS and sending it back to the one who requested it. It is an autoreply, For example, user A requests a location of user B via SMS without knowing that user A has this kind of request. Then automatically, it will get the current latitude and longitude of user B and send it back to user A. How to implement this? I'm very new to android development. Here's the snippet of my code. Thank you

String rtMessage = "Location: ";
    GPSActivity gpsActivity = new GPSActivity();

    rtMessage = gpsActivity.text;

    if (rtMessage!=null){
        rtMessage = "I get the location!";
    }
    else{
        rtMessage = "NO LOCATION\n\n";  
    }


SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(address, null, rtMessage , null, null);

来源:https://stackoverflow.com/questions/13821212/android-how-to-pass-data-like-latitude-and-longitude-from-gps-to-a-sms-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!