Implementing Night Mode for Sense on Android


Design spec Day and Night modes

Night Mode Resources

night theme profile
day theme profile
Picasso picasso = new Picasso.Builder(context)
# Clear entire cache
# Per request basis

Scheduled Night Mode

  1. User must grant runtime location permission to the app. (sdk 23+)
  2. Device location service settings are enabled and correct location mode is selected.
  3. A current location can be determined and stored for reference to calculate sunset and sunrise period.
runtime location permission request
Google Play Location Services in app request dialog
  • no way to be notified of an incoming scheduled theme change for existing activities.
  • no way to listen for location updates if failed to fetch last known location despite granting location runtime permission and enabling device location services.
  • not documented when the location used to calculate the sunset sunrise times would be updated to provide accurate scheduled theme changes.

Finishing Touches

Enter Exit Fade Window Animation



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store