Book Image

Learning Android Intents

By : Muhammad Usama bin Aftab, Wajahat Karim
Book Image

Learning Android Intents

By: Muhammad Usama bin Aftab, Wajahat Karim

Overview of this book

<p>Android is an emerging technology with loads of apps in the Google Play Market. Till date, it is the biggest marvel in Smartphone technology, propelling a larger number of developers into Android application development. Intent is an essential part of any Android Application and no Android application is complete without using them. Features such as listening broadcasts, sending messages, sharing via social networks, notifications, hardware components including camera, sensors, Wi-Fi, and more, can be used in your applications by using Intents.</p> <p>This practical guide focuses on using intents to make the best use of various features of Android platform. It is ideal for those developers who want to understand the backbone and the domain of Android Intents, its power, and the need for it inside an Android application. Practical, in-depth examples are used throughout the book, to help you understand the key concepts.</p> <p>The book starts with introducing the very basic concepts of Android, and its various facts and figures such as different Android versions, their release dates, evolution of Android phones and so on. While covering the basic technical concepts, it proceeds from the easiest route of introducing Android Intents towards the more practical view of Android Intents in terms of components and features.</p> <p>You will learn how to use different components and features such as transfer data between activities, invoke various features and components of Android, execute different in-built and custom-made services, use hardware and software components of Android device, and start Pending Intents &amp; notifications. You will gain better theoretical knowledge of what is running behind the concepts of Android Intents, and practical knowledge of the mobile-efficient ways to perform a certain task using Android Intents.</p> <p>Towards the end, you will have a clear vision and a practical grip on Android intents and its features. Learning Android Intents is a proper guide to give you the best knowledge of Intents.</p>
Table of Contents (16 chapters)
Learning Android Intents
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Pending Intents


Pending Intents are the intents which give token to other applications or you may call it a foreign application that may access your intent permission to run the predefined piece of code. This way, many other applications such as Alarm Manager and Calendar may use your application in order to execute their tasks.

Pending Intents are not run instantly; rather, they are run when some other activity wants it to run. Pending Intent is a reference that is maintained by the system so that it can be used at a later stage. That means that even if the application that contains the Pending Intent ends, another application can still use the context until cancel() is called over that intent.

Note

To perform a broadcast via a Pending Intent, use Pending Intent via PendingIntent.getBroadcast().

The Pending Intents can be launched via three methods, getActivity(Context context, int requestCode, Intent intent, int flags), getBroadcast(Context context, int requestCode, Intent intent, int flags...