SHARE
TWEET

Untitled

a guest Nov 13th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void sendLoction()
  2.     {
  3.         String phoneNumber="785373724";
  4.         String smsMessage = "I am in danger, HELP ! \n\n I am at " +"\n Latitude : "+MainActivity.latitude+"\nLongitude :  "+MainActivity.longitude+" ";
  5.  
  6.         if(checkPermission(Manifest.permission.SEND_SMS)){
  7.             SmsManager smsManager = SmsManager.getDefault();
  8.             smsManager.sendTextMessage(phoneNumber, null, smsMessage, null, null);
  9.             Toast.makeText(NotificationReceiver.this, "Message Sent!", Toast.LENGTH_SHORT).show();
  10.         }else {
  11.             Toast.makeText(NotificationReceiver.this, "Permission Denied", Toast.LENGTH_SHORT).show();
  12.         }
  13.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top