如何在SMSManager
的文本字符串中指定變量LocationManager
? 我想發短信的座標爲短信。如何通過短信發送Google地圖位置
private LocationManager lm; private LocationListener locationListener;
lm = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
locationListener = new MyLocationListener();
lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
locationListener);
lm.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
0,
0,
locationListener);
btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
btnSendSMS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
sendSMS("55565", "coords");
}
});
private void sendSMS(String phoneNumber, String message) {
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
請出示你的代碼來獲取位置進行修改。 – Simon
嘿@Simon ..我只是..預先感謝 –