Presentation from #andevcon by Anna Schaller
Peter van der Linden, Android Technology Evangelists from the Developer Platforms and Services team at Motorola Mobility. More info at http://developer.motorola.com
My name is Anna Schaller and I’m part of the Developer Community Tech Services Team at Motorola Mobility. Our job is to support 3 rd party developers writing android apps, especially targeted for Motorola devices.
Walkthrough of device from users perspective -- home screen; 5 panels -- upper left is the text and voice search -- upper right is the application tray and add to home screen -- Partial list apps preloaded and optimized for the tablet include -- gmail -- contact -- maps -- browser -- android market -- eBook reader -- google talk -- camera Walkthrough of specs
This is a typical Android smartphone. Across the top is your status bar where your status icons appear (battery, wifi, etc). This is also where your notifications can be found. Touching the status bar opens the notification panel. Moving to the bottom of the device, is where you’ll find buttons. Prehoneycomb devices were required to have 3 buttons – menu, home, and back. There’s usually a fourth button (in this case search). So that’s a typical smartphone.
When you’re talking about tablets things change. On the hardware side there are only three buttons on the device – volume up, volume down, and power.
Then when you talking about the platfom the whole user interface has changed.. From an apps perspective there are a couple things you should be aware of. For instance… You have the system bar along the bottom. The back and home button on the lower left. There is NO menu button. Menus are now all in software and only available from within an application. On the lower right is where your status bar icons now appear as well as you notification panel. From a user perspective there’s much more to it but from a developer’s standpoint, those are the things you should be aware of. They won’t necessarily impact your application but it may change the way you think about things.
Select a view that you want to associate the dimmer with (I have an id assigned to my root linearLayout) and set the visibility. You can attach the call to any view (including buttons) so may want to toggle it off and on with a button or putting inside any listener. If you touch the system bar the icons reappear. Touching the view dims the system bar. Book reader is a good example of dimming.
Replaces the title bar. This is the simplest form of an action bar. The Action Bar is included by default in all activities that target Android 3.0 or greater (setting minSdk or targetSdk = 11) Basic action bar with an overflow menu. The menu in the action bar replaces the hard menu button on the front of the device. The default behavior for the application icon is to do nothing. The title can be displayed or hidden.
Action bars get more feature rich from there. There are many extensions you can make to the action bar including -- actionable application icon with R.id.home in onOptionsMenuSelected -- adding tabs -- creating individual actionable items with or without text and titles -- Provide a drop-down list for navigation -- Provide a contextual action bar (CAB) -- Provide interactive &quot;action views&quot; in place of action items (such as a search box).
One final note on menus. To support forward compatibility a soft menu button is provided along the system bar for pre-honeycomb apps. If you open the menu you can see where and what the menu items looks like.
Starting from Android 1.6 and up developers can divide the Activities of their applications into subcomponents called Fragments. Fragments -- can be added, removed, replaced, and animated inside an Activity dynamically -- are modular and reusable across multiple Activities. Here we’ve got the updated version of the contacts app showing the list of contacts in a fragment on the left and the details of the selected contact in a fragment on the right.
Fragments can not stand on their own. They must be included in an activity. However fragments are self contained in that they have their own life cycle and every visible fragment has their own UI layout. One of the most common ways to use fragments is to associate a content fragment with an item in a list. There’s a separate type of fragment, called a ListFragment, that lets you do this. The content fragment can contain anything you would normally use in an activity – images, text, ui elements, etc.
To add a fragment without a UI, add the fragment from the activity using add(Fragment, String) (supplying a unique string &quot;tag&quot; for the fragment, rather than a view ID)
(Nothing changes in the AndroidManifest file) Adding a fragment to an activity requires updates to the activity’s layout file. You must add the fragment to your Activity’s layout file with a <fragment> tag. In the fragment tag you declare the class name of the fragment that’s defined usually in a separate .java file. Pay attention to the root layout or container you use. In this case I used LinearLayout which, by default has a top to bottom placement. So when I first did this app my fragments did not appear side-by-side, they appeared top-to-bottom. I needed to add orientation=horizontal in order to get the side-by-side. The device’s orientation is landscape by default so if you want a portrait version of the app to be top-to-bottom you’ll need to create another layout-port file specifying orientation=portrait.
In Android you can get hardware acceleration for 3d graphics through OpenGL ES 2.0 if you are using NDK. There is also software-enabled acceleration for 3d graphics using OpenGL ES 1.x. Until now there has been no support for 2D graphics..
Textures improve a 3d model with a visual realism that goes beyond just adding color. However the more detailed the textures become the larger the data size becomes which means that quite often you need to compress the texture data. The challenge for Android-powered devices is that the chipsets used in the devices support different compression types. So what do you do? PVRTC == Motorola Droid series ATITC == HTC S3TC == XOOM, Atrix, Bionic Android Market filters applications according to the texture compression formats that they support, to ensure that they can be installed only on devices that can handle their textures properly. Developers can use texture compression filtering as a way of targeting specific device types, based on GPU platform
Android Market filters applications according to the texture compression formats that they support, to ensure that they can be installed only on devices that can handle their textures properly. Developers can use texture compression filtering as a way of targeting specific device types, based on GPU platform
Follow instructions for using Data Storage to external media http://developer.android.com/guide/topics/data/data-storage.html Every Android-compatible device supports a shared storage. Shared files: Music/ - Media scanner classifies all media found here as user music. Podcasts/ - Media scanner classifies all media found here as a podcast. Ringtones/ - Media scanner classifies all media found here as a ringtone. Alarms/ - Media scanner classifies all media found here as an alarm sound. Notifications/ - Media scanner classifies all media found here as a notification sound. Pictures/ - All photos (excluding those taken with the camera). Movies/ - All movies (excluding those taken with the camcorder). Download/ - Miscellaneous downloads. Private files can be placed in /android/data/<appname> folder.
In 2.3 (Gingerbread) support for new sensor-based orientation settings were added that better supports 4-way rotation In your manifest at the <activity> node you can specify <activity …. android:orientation=“sensorPortrait” : supports portrait and reverse-portrait android:orientation=“sensorLandscape” : supports landscape and reverse-landscape android:orientation=“fullSensor” : supports 2 and 4-way rotation depending on device X and Y on portrait native device are on different long and short sides than landscape native.
Still need to define camera permission to use either camera If you want to filter the app from devices that don’t support front-facing camera add <uses-feature xxx…android.hardware.camera.front/>
There is a new package android.hardware.Camera.CameraInfo that stores properties of each camera. So you import this package, along with the Camera package. The Camera package now lets you get the number of cameras on the device so you can use this as an index to the camera. Once you have that index you can get to the front or rear camera.
XOOM screen supports 10-point multitouch – Android supports 5 or more simultaneous independent pointers.
Device perspective versus app perspective Think about why you need the unique identifier. If
Apps are always forward compatible but……
There is no way to make a phone call from the XOOM so dialer app is not there. If you call the dialer from your application it will not launch. Unless you explicitly specify the <uses-feature> tag, permissions imply that features are required. Permissions do not filter an app, the <uses-feature> tag does that. If you request permission for the Telephone without specifying a <uses-feature> tag the default filter is <uses-feature android:hardware.telephony” android:required=“true”/>. In this case your app will be filtered from the XOOM. Also keep in mind that on the wifi-only version of the tablet there is no IMEI or MEID, which in the past has been used as a unique identifier. If you query for it you get NULL. If you need a unique id, use the MAC address.
To find out what features may be blocking your app from a device there are two tools you can use: -- Aapt shows explicitly defined features with <uses-feature>. You must use the version of aapt that is provided for the latest Platform-Tools component available. -- MOTODEV App Validator is a web-based tool that lets you pre-test your application and show you where your app might fall through the cracks – such as implied features (permissions defined without a corresponding <uses-feature>). It shows you other things as well such as strings that are not completely localized.
There are two new features in 3.1 to support USB. Firstly there is built-in support for USB host mode that lets apps connect and manage peripherals. The device itself must have a USB controller, which the XOOM does. So the XOOM can operate in USB host mode. The second update is USB support for connected devices. There are two types of hardware supported: -- Peripherals can be a USB device meaning that they depend on the Android device to be the USB host. Cameras are a good example of this. -- Peripherals can also be a USB accessory meaning that they operate as the USB host to the Android device. A robotics controller is an example of this. At Google I/O they had an exercise bike with a mounted XOOM. The bike was the host and reported calories burned after pedaling some distance to an app on the XOOM.
Motorola Mobility Anna Schaller Android 기술 전도사 개발자 플랫폼 및 서비스 Motorola XOOM 용 앱 설계
수정 유무를 막론하고 소스 및 2 진수 형태로의 재배포 및 사용은 다음 조건이 충족될 경우에만 허용됩니다 .
소스 코드의 재배포는 위의 저작권 주의 사항 , 이 조건 목록 및 다음의 부인 고지 사항을 유지해야 합니다 .
2 진수 형태로의 재배포는 위의 저작권 주의 사항 , 이 조건 목록 및 다음의 부인 고지 사항을 배포물과 함께 제공되는 문서 및 / 또는 기타 자료에 복제해야 합니다 .
구체적인 사전 서면 허가가 없이는 이 소프트웨어에서 파생된 제품을 보증하고 홍보하는 데 Motorola, Inc. 이름 및 해당 기여자의 이름을 사용할 수 없습니다 .
이 소프트웨어는 저작권 소유자와 기여자에 의해 " 있는 그대로 " 제공되며 모든 명시적 또는 묵시적 보증 ( 상품성 및 특정 목적에 대한 적합성에 대한 묵시적 보증을 포함하며 여기에 제한되지 않음 ) 을 배제합니다 . 저작권 소유자 또는 기여자는 이 소프트웨어의 사용으로 인해 발생하는 모든 직접적 , 간접적 , 부수적 , 예외적 , 전형적 또는 결과적 손해 ( 대체품이나 대체 서비스의 조달 , 사용 , 데이터 또는 이익 손실 , 또는 영업 중단을 포함하되 이에 제한되지 않음 ) 에 대하여 계약에 의한 것이든 , 엄밀한 책임 또는 불법 행위 ( 또는 과실과 기타 행위를 포함하여 ) 에 의한 것이든 이와 여타 책임 소재에 상관없이 어떠한 경우에도 책임을 지지 않으며 , 이는 그와 같은 손해의 가능성을 사전에 알고 있던 경우에도 마찬가지입니다
이 프레젠테이션에서 표시되는 기타 소스 코드는 다른 라이센스 하에 제공될 수도 있습니다 .