1

I need to make an activity send a text message when it first loads on Android Studio. It's for a mobile safety app that automatically sends your location data to the police via SMS when the app first loads.

I'm trying the onStart method.

@Override
protected void onStart()
{   

super.onStart();
}

How can I do it or is there a better way?

Zoe
  • 27,060
  • 21
  • 118
  • 148

1 Answers1

1

You cannot send a text message without getting user permission and the same applies for assessing the location

Assuming that you had taken permission from USER and location is on

for sending the message here

and for accessing location on background here and here

Ashad Nasim
  • 2,511
  • 21
  • 37