14.01.2013 Views

Android™ Application Development - Bahar Ali Khan

Android™ Application Development - Bahar Ali Khan

Android™ Application Development - Bahar Ali Khan

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9: Peer-to-Peer Communication<br />

314<br />

}<br />

}<br />

}<br />

boolean includeLoc = prefs.getBoolean(includeLocationPref, false);<br />

respond(_from, respondText, includeLoc);<br />

You should now have a fully functional interactive and automated emergency responder.<br />

You can test it in the same way as described in the previous example by using a second emulator instance<br />

to receive the response messages, and the emulator controls to send the requests for status updates.<br />

Summary<br />

Technologies like SMS and instant messaging are providing an increasingly versatile platform for person-to-person<br />

communication.<br />

Android lets you use these text-based communication channels to create applications that let users send<br />

messages using instant messengers and SMS texts, as well as supplying an invisible data conduit for<br />

your applications to exchange data between devices.<br />

In this chapter, you learned how to connect to IM Sessions using the GTalk Service and how to send<br />

and receive text and data messages using these sessions. You learned about presence, how to set your<br />

own presence, and how to fi nd the presence of the contacts on the IM roster.<br />

You also used the SMS Manager to send and receive text and data messages from your applications.<br />

This chapter also showed you how future SDK release may allow you to:<br />

❑<br />

❑<br />

❑<br />

Add and remove instant messaging contacts.<br />

Block contacts and monitor the roster for changes.<br />

Manage group chats and chat rooms.<br />

Chapter 10 explores access to the low-level mobile hardware.<br />

Using the phone’s telephony services, you’ll initiate new calls and monitor both outgoing and incoming<br />

calls. You’ll be introduced to Android’s multimedia capabilities and use the media API to play back and<br />

record a variety of media resources.<br />

You’ll also learn how to interact with the Sensor Manager to access the compass and accelerometer<br />

before investigating network management using the Wi-Fi and Bluetooth APIs.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!