Smartphones are spectacular for snapping photos, scanning the news, and sending messages, but they can also be literal lifesavers if you take the time to set them up before the need arises.

Both Android and iOS have easy-to-use systems for sharing your location with a friend, family member, or other trusted contact in an emergency. You can even create connections that’ll allow you to check up on loved ones to see if their phone has detected movement lately and then request an automated location update if you’re unable to reach them.

The key to all of this is to configure your emergency system ahead of time so it’ll be available in case an actual emergency occurs. Take two minutes now, and then rest easy knowing your phone’s ready.

The simple option for iOS

If you’ve got an iPhone, Apple offers a built-in Emergency SOS system that gives you a quick way to call 911 (or the equivalent emergency service provider) and then alert a group of predefined emergency contacts — all in one fell swoop.

To start, you need to tell your phone who your emergency contacts are:

Open the Health app.

Tap the “Medical ID” tab.

Tap “Edit.” (If you haven’t yet created a medical ID, you’ll need to do that first.)

Find the “Add emergency contact” option, and add however many people you want.

Now, if you’re ever in an emergency situation with an iPhone 8 or later:

Press and hold the power button along with either volume button, and you’ll see an “Emergency SOS” countdown appear on your screen.

Keep holding both buttons until the countdown ends.

Your iPhone will automatically call 911, and as soon as the call disconnects, the phone will text your emergency contacts with your current location.

If you have an iPhone 7 or earlier, press the power button five times fast, then drag your finger across the Emergency SOS slider that appears on the screen to initiate that same process.

The simple option for Android

Android doesn’t have a similar all-in-one function, though it does provide a way to offer emergency services information about a preassigned emergency contact from the lock screen. While the setup may differ somewhat depending on what phone you have and which version of Android it runs, the basics should be the same.

Go to your phone’s lock screen. (You don’t have a screen lock set? Why not?)

Look for the word “Emergency” at the bottom of the lock screen. Tap on that.

Tap on “Emergency information” and then on the pencil symbol (or, depending on your phone, on “Add”). You’ll be asked to put in your PIN or lock pattern.

This will bring you to your Emergency information screen where you can add personal information (such as blood type or any existing medical conditions) and any contacts you want to be notified.

The advanced option for Android or iOS

For a more robust setup in which you can share and request locations with trusted contacts — without needing to make a 911 call — download Google’s Trusted Contacts app for Android or iOS. Once you’ve signed in, create your list of connections.

Tap the “Add Contacts” box on the app’s main screen.

Find and tap the name of anyone you want to add.

Once that person has approved your request (and installed the app onto their phone as well), you’ll always be able to see if they’ve been active recently and also if their phone’s battery is critically low.

Then, if you ever want to send a location alert:

On the app’s main screen, select the person with whom you want to share your location.

Tap “Send location alert now.”

Your location will be shared for 24 hours or until you hit the “Stop” button.

And to request someone else’s location:

Tap the person’s name on the app’s main screen.

Tap “Ask for [person’s] location.”

The app will alert the person to your request, and if they don’t respond within a set period of time, it’ll automatically share their location with you.

By default, Google’s Trusted Contacts app will share a requested location after five minutes without a response.

It’s the type of thing you hope you’ll never need, but with loved ones, in particular, it can bring valuable peace of mind to have it standing by just in case.