Windows Phone Guide for Android Application Developers Table of Content


Chapter 5: Application Lifecycle Differences Between Windows Phone and Android



Download 0.57 Mb.
Page10/15
Date04.05.2017
Size0.57 Mb.
#17233
1   ...   7   8   9   10   11   12   13   14   15

Chapter 5: Application Lifecycle Differences Between Windows Phone and Android


In this chapter, we look at the application lifecycle of the Windows Phone and compare it with that of Android. We will examine the various application states needed to support the navigation model, and what the developer needs to do to support those application states and the transitions between them.

Android and Windows Phone Application Lifecycle


Both Windows Phone 8 and Android have a limit of one application running in the foreground. They both support multitasking which allows other applications to run in the background. They both provide an illusion that applications are always running and allow application to be restarted “instantaneously.”

Android Application Lifecycle


When the user clicks the “home” button or launches another application, instead of terminating the running application, Android moves the foreground activity to the background. The background application remains alive in the phone memory and continues to execute. It can do what it needs to even though it does not have focus. For example, if it has a thread running in the background to download data, it can continue to do so.If the user returns to that activity, the activity is resumed or restarted. However, if there is memory pressure, Android destroys the activity and subsequently the activity must be restarted.

In addition, Android applications may include a service, a component that performs long running operations such as background music or data transfer. A service does not present user interface. A service may also be terminated in low memory situations.


Windows Phone Application Lifecycle


Windows Phone too supports multitasking and provides very similar features as Android. It supports fast application switching and background processing. When the user presses the start button while using an application, that application is deactivated and moved to background and kept intact in memory, in a state referred to as dormant. When the user navigates using the back button on the phone, this application is reactivated. Since the application was in memory, the reactivation is instantaneous. As the user invokes other apps, the Windows Phone OS reclaims memory by terminating dormant apps.

Consider that the user is composing a blog post, using the WordPress application, and then hits the start button to reach the Start screen, at which time the WordPress application is made dormant in which the application state is preserved in memory. The user then opens up the Facebook application. At this time, the Facebook application is launched. The user can hit the back button while in the Facebook application, to first reach the Windows Phone Start screen, and hit the back button again to go back to the WordPress application. The WordPress application would open with the compose screen, exactly how and where the user left it. The back button on Windows Phone behaves like browser back button. It not only allows the user to move through application pages but also through apps.

In addition to using back button, user can switch to another application in a number of ways. This includes fast switching to a dormant app by long pressing the back button, launching another app from the start button, or clicking on a toast or tile.

The following table describes the user events and compares the corresponding behavior in Android and Windows Phone.



User Action or Event

Android Behavior

Windows Phone Behavior

An incoming phone call or SMS that user answers

Running application is moved to the background, current activity is paused but the application is still in memory

Running application is deactivated and made dormant

User presses the Home button on the phone

Running application is moved to the background but application is still in memory and attached to window manager. Any background thread such as downloading data will continue to run.

Running application is deactivated and made dormant

User starts another application from the multitasking menu

Backround app is moved to foreground, If the activity was destroyed, it must be recreated and previous state restored.

Running application is deactivated and made dormant. Background application is moved to foreground and reactivated in its original state.

User navigates between applications using the Back button on the phone

Backround app is moved to foreground, If the activity was destroyed, it must be recreated and previous state restored..

Dormant application is made active again with its state intact. If the app was tombstoned it is activated and the app needs to recreate its state

User launches application by clicking on a toast

Running application is moved to the background, current activity is paused but the application is still in memory.

Running application is deactivated and then put into dormant state


Download 0.57 Mb.

Share with your friends:
1   ...   7   8   9   10   11   12   13   14   15




The database is protected by copyright ©ininet.org 2024
send message

    Main page