Chapter 8. Sharing data between apps

 

In this chapter

  • Sharing between processes
  • Shared preferences files
  • Accessing shared data

People have really gotten comfortable not only sharing more information and different kinds, but more openly and with more people.

Mark Zuckerberg

You can do a lot in a single Android application. The possibilities are almost endless. But one of the differentiating features of the Android platform is that it allows—nay, encourages—applications to work together. In chapter 5, we talked extensively about how powerful multitasking is on Android. Consequently, you can assume that other applications are running at the same time as yours and vice versa. This leads to interesting possibilities. Multiple applications working together provides greater value to the user than any single application could by itself.

An essential ingredient to application integration is data sharing. There are others, such as flow of control, but not much can happen without being able to share data between apps in some way. It should come as no surprise that Android provides multiple ways to do this, empowering you the developer to share data in a way that makes the most sense for your use case. The main purpose of this chapter is to catalogue and detail the various ways there are to share data between Android apps, and describe the type of situations that you would want to apply these data sharing techniques.

8.1. Process-to-process sharing

8.2. Accessing common data

8.3. Summary

sitemap