简体   繁体   中英

How do I send a SMS text message in the hidden background with current location data when the activity screen first loads on Android Studio?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM