Research and Simulation Implementation of Mobile Phone Communication Based on SL4A

INTRODUCTION Phone communication is the most basic and important function of mobile phone, for any mobile phone, the functions of SMS and call are indispensable. Android is an important engine for the rapid development of smart phone and is one of the most important operating systems for smart phone. Android has become the leading market leader in the global smart phone market with a market share of more than 70%[1] , it is of great significance to realize the research of mobile phone communication based on Android operating system. For a long time, JAVA is the main language for Android application development, Android application development mainly uses the JAVA language and the implementation of communication function of the Android phone is mainly using JAVA. It should be seen that using JAVA to develop Android application has many advantages, such as fast development and low occupancy resources, but this is unfortunate for other scripting languages. In the current the number of scripting languages is large, including PHP, Perl, Ruby, JavaScript, Python, etc. These scripting languages have features such as fast development and low learning cost. Developers have been trying to realize the communication between scripting languages and develop Android through other scripting languages. The emergence of SL4A make this wish come true. SL4A [1-3],[5],[6], originally called Android Scripting Environment(ASE), is an Android application component. Its aim is to utilize simply scripting languages such as Ruby, Python, Perl, PHP, JavaScript, etc to develop Android application and make Android application development more simply and quickly, it realize the communication between different scripting language and development Android applications using the different script development language. It has important significance for the evolution of Android phones. PFA [4] is abbreviation of PHP for Android, With the emergence of PFA, it is implemented to develop Android application using PHP scripts. PFA is an open source project launched by Irontec, which using the Android interface API provided by SL4A to implement Android development. With the PFA, linking PHP scripts to Android, PHP scripts can be easily developed for Android application, which will make Android application development easier and faster. Developers are increasingly trying to implement mobile phone communication based on Android operating system using PHP scripts. Mobile phone communication features include SMS, Call, ServiceState and DataConnection. In this paper, we propose a method based on SL4A and PHP scripts to realize mobile phone communication and simulate implementation the function of SMS and call. This paper is organized as follows. SL4A architecture is discussed in section II. Development environment configuration is given in section III. The Simulation experiment of SMS is given in section IV. The Simulation experiment of call is given in section V. Finally, section VI concludes the paper.

SL4A ARCHITECTURE SL4A is the scripting layer of Android, which is designed to develop Android applications with familiar scripting languages. SL4A has ability to support high-level scripting language such as Python, Perl, JRuby, Lua,BeanShell, PHP,JavaScript, Tel, shell and so on. The SL4A architecture and the process that a scripting file named myscript.py is to access Android service are shown in figure 1. As shown in figure 1, the SL4A system is composed of SL4A RPC Server components and script engines supported by SL4A .The script engines are responsible for the interpretation of the script application, The SL4A RPC Server component provides the Android primary ecosystem services to the scripts. The working principle of SL4A is based on JSON-RPC remote call, scripting application interacts with remote agent “SL4A RPC Server “via local script interpreters to access indirectly Android service in remote agent pattern . Firstly function calls of the local scripting, encapsulated in the JSON data format, are passed to SL4A RPC Server components by Scripting interpreters. After this SL4A RPC Server components call the Android functions in practice. Finally the operation results are returned to the local scripting interpreter, and then the results are put forward to scripting application for processing and displaying by the scripting interpreter.