ANDROID SERVICES Peter Liu School of ICT Seneca

  • Slides: 10
Download presentation
ANDROID SERVICES Peter Liu School of ICT, Seneca College

ANDROID SERVICES Peter Liu School of ICT, Seneca College

What is an Android Service? • an Android application • runs in the background

What is an Android Service? • an Android application • runs in the background • without an user interface (i. e. UI screen) • a piece of Android code that runs in the background

Android System Services • the Location Service • the Location. Manager class • the

Android System Services • the Location Service • the Location. Manager class • the Alarm Service • the Alarm. Manager class • more examples… • Wi. Fi Service • Bluetooth Service • Sensor Service • Programming with the APIs • the get. System. Service( ) methods • the <something>Manager objects

How To Program an Android Service? • Diagram • Three Examples • Two Student

How To Program an Android Service? • Diagram • Three Examples • Two Student Projects @ Seneca • Resources

How To Program an Android Service? • Example 1: Simple. Service • the life

How To Program an Android Service? • Example 1: Simple. Service • the life cycle of a service • Example 2: Little. Intent. Service • the Intent. Service • long-running background jobs • a worker thread vs the UI thread • data communication between an activity and a service

How To Program an Android Service? • Example 2 • data communication • use

How To Program an Android Service? • Example 2 • data communication • use an Intent to pass the data from an activity to a service • broadcast work status from a service to an activity • Should you use a thread or a service? • http: //developer. android. com/guide/components/services. html

How To Program an Android Service? • Example 3: My. Service • 2 forms

How To Program an Android Service? • Example 3: My. Service • 2 forms of a service • started • bound (for data communication) • use Intent for passing simple data • use method calls to pass complex data

How To Program an Android Service? • Best Practices for Background Jobs • http:

How To Program an Android Service? • Best Practices for Background Jobs • http: //developer. android. com/training/bestbackground. html

Two Student Projects @ Seneca • Natesh’s team (Android Game) • Edward Hanna at

Two Student Projects @ Seneca • Natesh’s team (Android Game) • Edward Hanna at CDOT (MMDI)

Resources • the course wiki • developer. android. com • http: //developer. android. com/guide/compo

Resources • the course wiki • developer. android. com • http: //developer. android. com/guide/compo nents/services. html