Chapter 8. Interacting with Other Apps

In this chapter, we will cover the following recipes:

  • Starting app components
  • Launching other apps
  • Obtaining data from activities
  • Using BroadcastReceivers
  • Scheduling tasks
  • Making phone calls
  • Intercepting phone calls
  • Sending SMS messages
  • Receiving SMS messages

Introduction

No app is developed or run in a vacuum. All users will have multiple apps installed on their devices, and we can take advantage of that to make our apps great.

If our app is an encyclopedia for a specific topic, we may want to share something. We can create mini Twitter, Facebook, and Google+ activities to interact with these social networks. We can create mini e-mail and SMS sections to support sharing in those formats. Alternatively, we can just use the user's favorite app that is installed on their device.

Using other apps that the user has installed on their device allows us to write smaller and more specific apps. We can then focus on our app and let the other developers improve their apps. This leads to a generally better app ecosystem. Also, if we use the app that the user prefers, we make our app friendlier to that user.

We may want our app to respond to system events and then change the way we work. For example, if the device loses connectivity, we can pause downloads and wait for the connection to return. If the battery runs low, we can make our app download fewer resources and maybe try stopping some background tasks. If the device reports an incoming call, we can pause the music or video so that the sound does not interfere with the call.

Responding to changes in the system allows the app to improve the user experience as the system changes. This leads to an app that makes the user feel like it is working with them to achieve a common goal.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset