Code components for starting your own Digital Wellbeing experiments
This repository contains example code for some of the Android features used to create Experiments for the Digital Wellbeing collection on the Experiments with Google site. Each directory contains a simple building block that you could use to start creating your own Digital Wellbeing Experiment, or integrate into an existing project.
The platform is a collection of ideas and tools that help people find a better balance with technology - exploring themes like how we find focus, avoid distractions and spend more quality time with others. We hope to inspire you to make digital wellbeing a key aspect to everything you design and make. Code from the experiments is open source, and we have created helpful guides to get you started. The more people that get involved the more we can all learn about building better technology for everyone.
We Flip is an experiment that encourages its users to switch off from technology as a group. When a group of users open the app together, they can flip an on-screen switch to put all their devices into Do Not Disturb mode. The first person to unlock breaks the session, ending Do Not Disturb for the group. We Flip uses the Nearby Messages API to detect user copresence.
How could apps use copresence to be more respectful of users spending time together in the real world?
Morph is an experiment that helps users stay focussed by adapting their phones to what they're doing, by letting them set up different 'Modes' for the different modes of their life. Each Mode is defined as a collection of apps, and a user defined 'trigger', which can be either a time or a place. This experiment used the Google Maps Places SDK and the Location & GeoFence APIs to switch its functionality based on the user's context, setting triggers for different states based on a user's location.
How could changing the functionality of an app based on context help users to focus better on their usage?
Post Box is an experiment that helps users minimise distractions by holding notifications until a time that suits them. To build this experiment, we used the Notification Listener API to gather incoming notifications, store them to a database, and present them to the user later at a time that they have configured.
The first demonstrates how to create a notification listener service which uses notification access permissions to receive all incoming notifications, add them to a database, and present them in a simple list view to the user.
The second demonstrates how to use the snooze functionality of the Notifications API, which pauses delivery of a notification until a later time. Any notifications received while the app is on screen can be paused for 60 seconds, or allowed to pass through to the OS notification system. This was used in the Morph experiment to pause delivery of notofications from apps outside of a user's current mode.
Finally, a simple notification generator is included for testing your new notification handling experiment.
How could your app use notifications in a way that better respects your user's attention?
Desert Island is an experiment which challenges users to find focus by going a day with only their essential apps. We used the Package Manager API to enumerate the apps installed on the a user's device to present them with a simple, stripped back list of what they have installed on their phones, and keep a track of which apps they open in order to give them feedback on how they use their device.
How could a launcher or app help users focus, or be less distracted when using their device?
How else could a live wallpaper help a user to be more conscious of their tech usage?
Our phones are always-on, always-connected computers, able to update and notify users of new developments and incoming information in real time. However, live data feeds and streaming messages can be both unpredictable and disruptive to users. Using the Alarm Manager API, your app can defer actions until a scheduled point in the future, rather than interrupting a user with notifications.
How could you use scheduled actions to build more respectful and purposeful features for your users?
This sample code was created by Google Creative Lab for a series of Android experiments in the Digital Wellbeing collection. This is not an official Google product.
We encourage open sourcing projects as a way of learning from each other. Please respect our and other creators’ rights, including copyright and trademark rights when present when sharing these works and creating derivative work. If you want more info on Google's policy, you can find it here. To contribute to the project, please refer to the contributing document in this repository.