Mobile Lect 02
Mobile Lect 02
Ewnetu E. (MSC.)
Constraint
Linear
Relative
Table
Absolute
Frame
Relative layout
Table layout
Absolute layout
Frame layout
Service: is a background process that can run for a long time (e.g.
music).
A service is a component that performs operations in the background
usually without a user interface.
Should be used if something needs to be done while the user is not
interacting with application.
Needs to be declared in manifest file.
There are two main ways of using service:
▶ Foreground: a service that will let the user know about what is
happening in the background.
⋆ e.g, in Music app., the user can see the ongoing song on the device as
a form of notification.
▶ Background: the user will never know about what is happening in the
background of the application.
⋆ e.g, while sending some images over Whatsapp, Whatsapp compresses
the image file to reduce the size.
Ewnetu E. Activities, Intents and Services May 17, 2024 23 / 36
Difference between Service and IntentService
Usage:
▶ If you want some background task to be performed for a long time,
then you should use the IntentService.
▶ You can use service for the tasks that don’t require any UI and also it
is not a very long running task.
How to Start?:
▶ To start a service, call the onStartService() method
▶ To start IntentService, use Intent → i.e. start the IntentService by
calling Context.startService(Intent).
Running Thread: service always runs on the main thread while the
IntentService runs on a separate worker thread that is triggered from
the main thread.
Triggering Thread: service can be triggered from any thread while the
IntentService can be triggered only from the main thread.
Step 4: ...Cont’d
▶ Hybrid: this approach is the latest approach to develop any app.
⋆ It combines pre-built native containers with on-the-fly web coding in
order to achieve the best of both worlds.
⋆ In this approach, the developer augments the web code with native
language to create unique features and access native APIs which are
not yet available through JavaScript. e.g; Instagram
Step 5: App prototype
▶ It is actually the process of taking your idea and turning it into an
application with some basic functionality.
▶ A prototype makes it quite easier to sell your idea to potential buyers
who can now actually view the tangible benefits instead of just
visualizing or reading product description.
▶ Helpful in attracting investors.