Skip to content

Camera and Location

You'll use the camera and the phone's location in one app, ask for each permission at the moment it's needed, and keep the app working when the answer is no.

About

Sensors are the point of a phone, and they come with the first bit of trust you'll negotiate with a user. Ask for a permission on launch and most people tap Don't Allow, and on iOS you get one shot at the system prompt. Ask at the moment someone taps the shutter, with a sentence of your own about why, and most people say yes. The app also has to behave when they say no: a sentence and a link to Settings, not a crash and not a nag every launch. iOS kills the app on the spot if you touch the camera without a purpose string in Info.plist. Build a small app of photos pinned to places, and look up from the phone at road crossings while you collect them.

At a glance

Per requirement
25 XP
Completion bonus
150 XP
Requirements
6
Takes
One weekend
Skill level
Intermediate (months of practice)
Cost
Free
Supplies
Nothing special
Where
Around town
Other people
On your own
Locked for now
Earn two more Common badges in Mobile Apps to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Take a photo inside your app and show it on screen. The system camera is enough (UIImagePickerController, TakePicture on Android, or image_picker in Flutter). Write the purpose string before you run it, because without one iOS crashes the app with no useful message. Film taking a photo and seeing it appear in your app. Video
  2. 2
    Ask for the camera permission only when the shutter button is tapped. Before the system prompt, show one sentence of your own on why you want the camera. Delete and reinstall the app so the prompt is fresh. Film the path from the button to the system prompt. Video
  3. 3
    Handle Don't Allow without a crash and without nagging. Deny it, then show a sentence and a button that opens your app's own page in Settings. Don't prompt again on every launch. Film the deny path from the tap to the Settings page. Video
  4. 4
    Get the phone's location and show it on a map. Ask for location while the app is in use, not always, and offer the approximate option on Android unless you can say why you need better. Drop a pin on the platform's map view. Film the map with the pin where you actually are, or blur it if you'd rather not say. Video
  5. 5
    Save each photo with its coordinates and sort them by distance from you. Store the pair together and sort the list by how far each one is from your current position. Walk to three places to collect them, and keep your eyes up near traffic. Take a photo of the list with three entries from three places. Photo
  6. 6
    Turn both permissions off in Settings and use the app anyway. It should still show the saved items and explain in a sentence what's switched off. Film the app running with both permissions denied. Video