230 likes | 339 Views
Особенности разработки под мобильную платформу. Almaty GTUG, 2011 Ермек Жумагулов yermek.zhumagulov@gmail.com. "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." .
E N D
Особенности разработки под мобильную платформу Almaty GTUG, 2011 Ермек Жумагулов yermek.zhumagulov@gmail.com
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." -- Bjarne Stroustrup
Few reasons to go Mobile Application Development: Smart Phones Internet access anywhere Social networking Millions of mobile users Open standards Android market growing faster than App Store Just for fun
Android Runtime • Dalvik VM • Dex files • Compact and efficient than class files • Limited memory and battery power • Core Libraries • Java 5 Std edition • Collections, I/O etc…
Application Building Blocks • Activities • Services • Content providers • Broadcast receivers • AndroidManifest.xml • Notifications
Activities • An activity represents a single screen with a user interface; • An activity is implemented as a subclass of android.app.Activity;
Services • Runs in the background to perform long-running operations or to perform work for remote processes; • Does not provide a user interface; • A service is implemented as a subclass of android.app.Service;
Content providers • Manages a shared set of application data; • Useful for reading and writing data; • Implemented as a subclass of android.content.ContentProvider;
Broadcast receivers • Component that responds to system-wide broadcast announcements; • Way to respond to external notification or alarms; • Apps can invent and broadcast their own Intent;
Intents • is a simple message object that represents an “intention” to do something; • is an abstract description of an operation to be performed; • For activities and services, an intent defines the action to perform (for example, to "view" or "send" something); • For broadcast receivers, the intent simply defines the announcement being broadcast (for example, a broadcast to indicate the device battery is low includes only a known action string that indicates "battery is low").
AndroidManifest.xml • Application level configuration file; • It describes the components of the application; • It declares which permissions the application must have;
There is a common file structure for applications code Autogenerated resource list files images UI layouts constants
UI layouts are in Java and XML setContentView(R.layout.hello_activity); //will load the XML UI file
Cloud To Device Computing • Android Cloud to Device Messaging (C2DM) makes it easier for mobile applications to sync data with servers. Many of the Google applications on Android already use push to keep their data fresh, for example Gmail, Contacts, Calendar. Starting with Android 2.2, C2DM allows third-party developers to use the same service.
Chrome to Phone comprises a Chrome Extension, an Android Application, and a Google AppEngine server. All of the code is open sourced and serves as a nice example of how to use C2DM.
ACTION_NEW_OUTGOING_CALL broadcast is sent whenever the user tries to initiate a phone call. There are several reasons that one would want to be notified about this, but we will focus on only 2: • To be able to reject an outgoing call; • To be able to rewrite the number before it is dialed. In the first case, an app may want to control what numbers can be dialed or what time of the day numbers can be dialed. Note that you should associate this receiver with the ACTION_NEW_OUTGOING_CALL broadcast in the manifest file for your application.
Associatereceiver CallReceiver.java with the ACTION_NEW_OUTGOING_CALL broadcast in the AndroidManifest.xml • Autorun reciever and custom broadcast
Android resources • Developers guide • Android developers blog • Stack Overflow
Спонсоры Неизменным спонсором GTUG является Казахстанско-Британский Технический Университет, поддерживающий наши инициативы и предоставляющий замечательные аудитории для проведения встреч. Финансовым спонсором мероприятий GTUG является компания Bee Software - молодая и успешная компания, разрабатывающая программное обеспечение для корпоративных заказчиков.