Android Training Lesson 7: FPT Software
Android Training Lesson 7: FPT Software
Android Training Lesson 7: FPT Software
ANDROID TRAINING
LESSON 7
Version 0.1
Activities Services
1.Provides User Interface 1. No User Interface
2.Usually represents a Single Screen 2.Runs in Background
3.Can contain one/more Views 3. Extends the Service Base Class
4. Extends the Activity Base class
• There are three static PendingIntentfactory methods which can be used to obtain a
PendingIntent
– public static PendingIntent getActivity(Context context, int requestCode, Intent intent,
int flags)
– public static PendingIntent getBroadcast(Context context, int requestCode, Intent intent,
int flags)
– public static PendingIntent getService(Context context, int requestCode, Intent intent,
int flags)
• These return PendingIntent instances which can be used to
– start an activity,
– perform a broadcast, or
– start a service
• Depending upon the given arguments each of these methods can either
– create a new PendingIntent object,
– modify an existing PendingIntent object,
– modify an existing PendingIntent object and create a new PendingIntent object, or
– do nothing
Activity
OS BroadcastReceiver
BroadcastReceiver
BroadcastReceiver
BroadcastReceiver
2. We add the following code for sending SMS from anywhere of our application