知识库

Android Programming

网站:知识库   来源:网络收集

Android Programming Introduction The Open Handset Alliance released the Google Android SDK on November 12th, 2007, having announced it about a week before. The impact was unbelievable, almost every IT/programming-related news- page dumped a news-post about the SDK release – the Google Groups was overwhelmed with over 2000 Messages within the first two Days. The idea of the Android Platform was and still is amazing and is of course attracting more and more programmers every day. Especially the open architecture based on Intents and the possibility to replace even the Home-application grant a really large amount of flexibility to the whole platform. What is Android – a GPhone? The weeks and months before Google released the Android SDK there had been a lot of rumors about a so called GPhone. It was said to be a mobile device manufactured by Google providing free communication by showing context-sensitive advertisements to the user on the device itself. But on November 5th ,2007 Andy Rubin announced: “[The] Android [Platform] – is more significant and ambitious than a single phone.” Google within the Open Handset Alliance (OHA) delivers a complete set of software for mobile devices: an operating system, middleware and key mobile applications. What was released a week later was not a final product,but a “First Look SDK” what many did not realize. Major news sites grabbed the discomforts of some developers who said that Android is full of bugs and heavily lacks of documentation. But the majority says that Android is not buggier than any other software at this stage. Android from above Let’s take a look at what the OHA emphasizes on its Android Platform: Openness “Android was built from the ground-up to enable developers to create compelling mobile applications that take full advantage of all a handset has to offer. It is built to be truly open. For example, an application could call upon any of the phone's core functionality such as making calls, sending text messages, or using the camera, allowing developers to create richer and more cohesive experiences for users.” This is true,as a developer you can do everything, from sending short messages with just 2 lines of code, up to replacing even the HOME- Screen of your device. One could easily create a fully customized operating system within weeks, providing no more of Google’s default application to the user. “Android is built on the open Linux Kernel. Furthermore, it utilizes a custom virtual machine that has been designed to optimize memory and hardware resources in a mobile environment. Android will be open source; it can be liberally extended to incorporate new cutting edge technologies as they emerge. The platform will continue to evolve as the developer community works together to build innovative mobile applications.” Here Google is talking of the so called Dalvik virtual machine (DalvikVM), which is a register based virtual machine, designed and written by Dan Bornstein and some other Google engineers, to be an important part of the Android platform. In the words “register based” we find the first difference to normal Java virtual machines (JVM) which are stack based. All applications are created equal “Android does not differentiate between the phone's core applications and third-party applications. They can all be built to have equal access to a phone's capabilities providing users with a broad spectrum of applications and services. With devices built on the Android Platform, users will be

able to fully tailor the phone to their interests. They can swap out the phone's home screen, the style of the dialer, or any of the applications. They can even instruct their phones to use their favorite photo viewing application to handle the viewing of all photos.” Breaking down application boundaries “Android breaks down the barriers to building new and innovative applications. For example, a developer can combine information from the web with data on an individual's mobile phone - such as the user's contacts, calendar, or geographic location - to provide a more relevant user experience. With Android, a developer could build an application that enables users to view the location of their friends and be alerted when they are in the vicinity giving them a chance to connect.” Fast & easy application development “Android provides access to a wide range of useful libraries and tools that can be used to build rich applications. For example, Android Additionally this application could be enriched with the current GPS- position of the device within a handful of code-lines. Google emphasizes Androids power of providing location-based-services. Google Maps are so neat within Android as if it was just developed for Android. One can integrate a fully zoom and drag enabled map by adding just 3(!) characters in the Java-Code of the Android-Default-Application and 3 lines of XML-Code. Other nice features that are easy to use with Android are Animations and media-playback. Since version m5, the Android SDK contains functions for straight and reverse GeoCoding and in addition to mp3, playback of: ogg-Vorbis, MIDI and a bunch of other formats. What Android tries to do is meet you halfway: You get a commonly used programming language (Java) with some commonly used libraries (e.g., some Apache Commons APIs), with support for tools you may be used to using (Eclipse). You get a fairly rigid and separate framework in which your programs need to run so they can be “good citizens” on the phone and not nterfere with other programs or the operation of the phone itself. As you might expect, much of this book deals with that framework and how to write programs that work within its confines and take advantage of its capabilities. What Androids Are Made Of When you write a desktop application, you are “master of your own domain.” You launch your main window and any child windows—like dialog boxes—that are needed. From your standpoint, you are your own world, leveraging features supported by the operating system, but largely ignorant of any other program that may be running on the computer at the same time. If you do interact with other programs, it is typically through an API, such as Java Database Connectivity (JDBC), or frameworks atop it, to communicate with MySQL or another database. Android has similar concepts, but packaged differently and structured to make phones more crash-resistant. Here are the main components used in an Android application: Activities: The building block of the user interface is the activity. You can think of an activity as being the Android analogue for the window or dialog box in a desktop application. While it is possible for activities to not have a user interface, most likely your “headless” code will be packaged in the form of content providers or services. Content providers: Content providers provide a level of abstraction for any data stored on the device that is accessible by multiple applications. The Android development model encourages you to make your own data available to other applications, as well as your own. Building a content provider lets you do that, while maintaining complete control over how your data is accessed.

Services: Activities and content providers are short-lived and can be shut down at any time. services, on the other hand, are designed to keep running, if needed, independent of any activity. You might use a service for checking for updates to an RSS feed or to play back music even if the controlling activity is no longer operating. Intents: Intents are system messages, running around the inside of the device, notifying applications of various events, from hardware state changes (e.g., an SD card was inserted), to incoming data (e.g., an SMS message arrived), to application events (e.g., your activity was launched from the device’s main menu). Not only can you respond to intents, but you can create your own to launch other activities or to let you know when specific situations arise (e.g., raise such-and-so intent when the user gets within 100 meters of this-and-such location). Stuff at Your Disposal Android comes with a number of features to help you develop applications: Storage: You can package data files with your application, for things that do not change, such as icons or help files. You also can carve out a bit of space on the device itself, for databases or files containing user-entered or retrieved data needed by your application. And, if the user supplies bulk storage, like an SD card, you can read and write files there as needed. Network: Android devices will generally be Internet-ready, through one communications medium or another. You can take advantage of the Internet access at any level you wish, from raw Java sockets all the way up to a built-in WebKit-based web browser widget you can embed in your application. Multimedia: Android devices have the ability to play back and record audio and video. While the specifics may vary from device to device, you can query the device to learn its capabilities, and then take advantage of the multimedia capabilities as you see fit—whether that is to play back music, take pictures with the camera, or use the microphone for audio note-taking. Global positioning system (GPS): Android devices will frequently have access to location providers, such as a GPS, which can tell your applications where the device is on the face of the Earth. In turn, you can display maps or otherwise take advantage of the location data, such as tracking a device’s movements if the device has been stolen. Phone services: Of course, since Android devices are typically phones, your software can initiate calls, send and receive Short Message Service (SMS) messages, and everything else you expect from a modern bit of telephony technology.

相关内容
  • Enterprise Android∶ Programming Android Database

    Enterprise Android∶ Programming Android Database

    Enterprise Android∶ Programming Android Database ...

  • Programming of Android

    Programming of Android

    Programming of Android...

  • Android-Programming-Basics

    Android-Programming-Basics

    Android-Programming-Basics...

  • Professional Android Sensor Programming

    Professional Android Sensor Programming

    Professional Android Sensor Programming...

  • Beginning-Android-Programming

    Beginning-Android-Programming

    Beginning-Android-Programming...

  • 5-2 Android Wlan Software programming Guide for Android_0.6

    5-2 Android Wlan Software programming Guide for Android_0.6

    5-2 Android Wlan Software programming Guide for Android_0.6...

  • Android_Programming_Succinctly

    Android_Programming_Succinctly

    Android_Programming_Succinctly...

  • Programming Android for fun and profit

    Programming Android for fun and profit

    Programming Android for fun and profit...

  • Socket Programming on Android

    Socket Programming on Android

    Socket Programming on Android...

  • Practical Programming on Android Introduction

    Practical Programming on Android Introduction

    Practical Programming on Android Introduction...

  • 网友在搜
    华为nova2换屏图解 isql 执行select 吸烟都有哪些危害 生化危机4 wii汉化下 tera 005磁力迅雷 earth and fire 青年网络公开课 官网 上海市幼儿园二期课改 三国战纪2防具 ios字体阴影效果 novat266机顶盒的密思 伊利oa办公系统 人人都爱女主角 c 常用第三方控件 vivox9plusl多少寸 linux挂载u盘 extfat rubber process oil 国产mm死之验尸图 新秀传媒培训要交钱吗 麒麟960玩游戏 多线程同时insert 手机cmcc edu登陆界面 udp 203 越狱 虚拟 英语 海盗船风扇怎么样 dreamleague 球场升级 家常牛肉丝炒什么好吃 suitsupply 档次 近场探头 lg h955双清 佛山机场快线时刻表 Sanic uvloop windows安装redis 克拉恋人简介剧情 存在主义心理治疗 主题 fate英灵属性设定 lbp 人脸识别 python 符文大师出装 sn.122.gov 京东联盟有手机版吗 3ds max动物模型下载 abaqus中密度单位 xps15升级固态硬盘 d3303动车路线票价 体重dmi是什么意思 精仿iphone7 plus拆机 final cut 电影 ∫0-∏/2sinxcos∧3xdx czech streets在哪拍的 axislabel 字体左移

    All Right Reserved 知识库

    声明:本站内容源于网络,出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。文章内容仅供参考,请咨询相关专业人士。

    如果无意之中侵犯了您的版权,或有意见、反馈或投诉等情况 网站地图 网站栏目