CS-EJ4102 - Mobile Application Development with Android D, 07.09.2020-23.10.2020
Kurssiasetusten perusteella kurssi on päättynyt 23.10.2020 Etsi kursseja: CS-EJ4102
Mobile services
Distributed (mobile) applications
Most mobile applications have very limited capabilities without an Internet connection: think about WhatsApp or Instagram. This happens because they rely on functionality that is not implemented by the app itself but are rather available as a service over the network. Examples include data storage and synchronization, messaging and location-based services. Consequently, such mobile applications are distributed: the user-facing component running at the mobile device (including the graphical user interface) is called the frontend, while the component that realizes the services in a certain network is called the backend. These also correspond to the client-server architecture of distributed applications: the frontend is the client, whereas the backend is the server. Nowadays the backend generally runs on a public cloud provider; for this course, it is enough to consider a server as a physical machine or just as an application process.
Thin-client computing
Despite the advances in hardware manufacturing and in wireless communication technologies, mobile devices are still much more resource-constrained than desktop computers, workstations, and even laptops. The fundamental limitation of smartphones and tablets, for instance, is represented by their battery: it provides a limited amount of energy before it needs to be recharged, thus significantly limiting utilization on the move. To overcome the resource constraints of mobile devices, several solutions have been proposed. One of them is given by remote display access. With this approach, mobile devices use a lightweight software client and connect to a remote display server running one or more applications. The thin client displays the graphical user interface of the remote applications on the mobile device and relays all input events to the server. The server then processes the inputs and sends the changes in the content to be displayed back to the client. There are several remote display solutions available, but many of the leading products are based on a few technologies and protocols that are summarized below.
- Virtual Network Computing (VNC) is an established multi-platform remote desktop solution. It is built on top of the Remote Framebuffer (RFB) protocol, which evolved over time to include extensions and optimizations introduced by software derived from the original VNC server. RFB, as the name suggests, operates at the level of the framebuffer, namely, the portion of the memory that contains the description of pixels to be shown on a display (i.e., a frame). Accordingly, RFB is based on primitives which can draw rectangular regions on the display. Each region can be encoded in different ways (for instance, as JPEG images) and a sequence of drawing primitives produces a framebuffer update. Updates are triggered by the client which can autonomously decide when to request them. In addition to the display, the RFB protocol supports any input device which can be mapped to a keyboard and a pointing device (e.g., a mouse) with multiple buttons.
- Remote Desktop Protocol (RDP) is a proprietary protocol designed by Microsoft for remote input and display of hosts running the Windows operating system. Despite being OS-specific, RDP clients and servers also exist for operating systems other than Microsoft Windows. RDP supports more primitives than VNC for screen updates as well as data transmission over multiple channels. It also interfaces with a wider range of input devices and provides several forms of redirection, including audio, printer, and filesystem access.
Computation offloading
A different solution to overcome the resource constraints of mobile devices is represented by computation offloading. Offloading means transferring resources from one system to another; in the context of mobile computing, offloading involves moving data or tasks from one device (e.g., a smartphone) to a powerful server. The goal is to enable processing that would not be possible on mobile devices, or would otherwise consume too many resources – thereby taking long time or quickly depleting batteries. One important example is given by object detection (such as in Google Lens) or face recognition (such as in Facebook or Google Photos): these are very computationally expensive, especially when they involve artificial intelligence and deep learning. Instead of performing detection (recognition) at the mobile devices, pictures can be sent to a server for processing and the result (i.e., the name of an object or person) is retrieved over the Internet.
Offloading in distributed mobile applications is achieved by partitioning its functionality: logical functions are mapped onto different components of a distributed system. These components are interconnected through some API over the network, generally employing either the Representational State Transfer (REST) architectural style or remote procedure calls. Partitioning can be done in different ways, for instance, by deciding on the mapping between functions and components during the application design phase.