ANDROID How to pass data (like Latitude and Longit

2019-07-09 03:54发布

问题:

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);