Survey							
                            
		                
		                * Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Developing Android Apps Developing Android Apps SysWAY Technologies www.sysway.co.in Contents: ABSTRACT ............................................................................................................................1 ANDROID ECOSYSTEM ........................................................................................................1 ANDROID DEVELOPMEN TOOL...........................................................................................2 Development Procedure.......................................................................................................... 2 Testing the android APP..........................................................................................................7 Conclusion................................................................................................................................9 ABSTRACT Android's default user interface is based on direct manipulation, using touch inputs, that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects, and a virtual keyboard. The response to user input is designed to be immediate and provides a fluid touch interface, often using the vibration capabilities of the device to provide hap tic to the user. Internal hardware such as accelerometers, gyroscopes and proximity sensors are used by some applications to respond to additional user actions, for example adjusting the screen from portrait to landscape depending on how the device is oriented, or allowing the user to steer a vehicle in a racing game by rotating the device, simulating control of a steering wheel. Android devices boot to the home screen, the primary navigation and information point on the device, which is similar to the desktop found on PCs. Android home screens are typically made up of app icons and widgets; app icons launch the associated app, whereas widgets display live, auto-updating content such as the weather forecast, the user's email inbox, or a news ticker directly on the home screen. A home screen may be made up of several pages that the user can swipe back and forth between, though Android's home screen interface is heavily customisable, allowing the user to adjust the look and feel of the device to their tastes. Third-party apps available on Google Play and other app stores can extensively re-theme the home screen, and even mimic the look of other operating systems, such as Windows Phone. Most manufacturers, and some wireless carriers, customise the look and feel of their Android devices to differentiate themselves from their competitors ANDROID ECOSYSTEM With a large number of custom versions of the Android platform emerging, there are concerns that this fragmentation will result in the inability of some devices to properly run apps written with the Android SDK. Despite several efforts from Google to help quell fears of Android fragmentation, the threats about device-specific apps leading to interoperability issues persist nonetheless. The most important reasons for testing the app over a number of handsets are: Different OS versions: Android 2.0 (Éclair) was released in October 2009, and within the next 3 years, as many as 12 new versions (with different API levels) were launched. This fact shows how fast the Android Operating System is evolving. This requires both the developers and testers to adapt quickly - not just to maintain pace with the newer OS flavours but also to ensure backward compatibility. 1 Developing Android Apps Different Screen sizes: The app should try to provide a consistent user experience across a variety of screen sizes of Android devices. These are usually categorized into 4 generalised sizes: small, normal, large and x-large. Screen Orientation - It is considered a variation of screen size and it becomes important to test whether the app revises its layout on changing from landscape to portrait and vice versa to optimize the user experience along with avoiding any functionality break. Different Device Manufacturers and Handsets: A 2012 report from OpenSignal published the logged data of 681,900 devices, which downloaded one of their apps. The extent of device fragmentation was clearly evident with 3997 distinct Android devices, spanning around 599 distinct brands across 195 countries spotted in this study. Again, over 1363 devices appeared only once in their database due to custom ROMs overwriting the android.build.MODEL variable. The number of distinct android devices is expected to have catapulted to around 12,000 in 2013. ANDROID DEVELOPMENT TOOL The Android SDK provides the API libraries and developer tools necessary to build, test, and debug apps for Android. Download the ADT Bundle to quickly start developing apps. It includes the essential Android SDK components and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development. With a single download, the Eclipse ADT bundle includes everything you need to begin developing apps:      Eclipse + ADT plugin Android SDK Tools Android Platform-tools A version of the Android platform A version of the Android system image for the emulator DEVELOPMENT PROCEDURE This class teaches you how to build your first Android app. You’ll learn how to create an Android project and run a debuggable version of the app. You'll also learn some fundamentals of Android app design, including how to build a simple user interface and handle user input. Before you start this class, be sure you have your development environment set up. You need to:  Download the Android SDK.   Install the ADT plugin for Eclipse (if you’ll use the Eclipse IDE). Download the latest SDK tools and platforms using the SDK Manager. Note: Make sure you install the most recent versions of the ADT plugin and the Android SDK before you start this class. The procedures described in this class may not apply to earlier versions. If you haven't already done these tasks, start by downloading the Android SDK and following the install steps. Once you've finished the setup, you're ready to begin this class. 2 Developing Android Apps This class uses a tutorial format that incrementally builds a small Android app that teaches you some fundamental concepts about Android development, so it's important that you follow each step. Creating an Android Project Note: You should already have the Android SDK installed, and if you're using Eclipse, you should also have the ADT plugin installed (version 22.6.2 or higher). If you don't have these, follow the guide to Installing the Android SDK before you start this lesson. Create a Project with Eclipse 1. Click New in the toolbar. 2. In the window that appears, open the Android folder, select Android Application Project, and click Next. Figure 1. The New Android App Project wizard in Eclipse. 3. Fill in the form that appears:      Application Name is the app name that appears to users. For this project, use "My First App." Project Name is the name of your project directory and the name visible in Eclipse. Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace. Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project. Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application. 3 Developing Android Apps As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.  Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.  Theme specifies the Android UI style to apply for your app. You can leave this alone. Click Next. 4. On the next screen to configure the project, leave the default selections and click Next. 5. The next screen can help you create a launcher icon for your app. You can customize an icon in several ways and the tool generates an icon for all screen densities. Before you publish your app, you should be sure your icon meets the specifications defined in the Iconography design guide. Click Next. 6. Now you can select an activity template from which to begin building your app. For this project, select Blank Activity and click Next. 7. Leave all the details for the activity in their default state and click Finish. Your Android project is now a basic "Hello World" app that contains some default files. To run the app. Create a Project with Command Line Tools If you're not using the Eclipse IDE with the ADT plugin, you can instead create your project using the SDK tools from a command line: 1. Change directories into the Android SDK’s tools/ path. 2. Execute: android list targets This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target id. We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices. If you don't see any targets listed, you need to install some using the Android SDK Manager tool. See Adding Platforms and Packages. 3. Execute: android create project --target <target-id> --name MyFirstApp \ --path <path-to-workspace>/MyFirstApp --activity MainActivity \ --package com.example.myfirstapp Replace <target-id> with an id from the list of targets (from the previous step) and replace <pathto-workspace> with the location in which you want to save your Android projects. Your Android project is now a basic "Hello World" app that contains some default files. To run the app, continue to the Tip: Add the platform-tools/ as well as the tools/ directory to your PATH environment variable. Before you run your app, you should be aware of a few directories and files in the Android project: AndroidManifest.xml 4 Developing Android Apps The manifest file describes the fundamental characteristics of the app and defines each of its components. You'll learn about various declarations in this file as you read more training classes. One of the most important elements your manifest should include is the <uses-sdk> element. This declares your app's compatibility with different Android versions using the android:minSdkVersion andandroid:targetSdkVersion attributes. For your first app, it should look like this: <manifest xmlns:android="http://schemas.android.com/apk/res/android" ... > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> ... </manifest> You should always set the android: target Sdk Version as high as possible and test your app on the corresponding platform version. For more information, read Supporting Different Platform Versions. src/ Directory for your app's main source files. By default, it includes an Activity class that runs when your app is launched using the app icon. res/ Contains several sub-directories for app resources. Here are just a few: Draw able - hdpi/ Directory for drawable objects (such as bitmaps) that are designed for high-density (hdpi) screens. Other draw able directories contain assets designed for other screen densities. layout/ Directory for files that define your app's user interface. values/ Directory for other various XML files that contain a collection of resources, such as string and color definitions. When you build and run the default Android app, the default Activity class starts and loads a layout file that says "Hello World." The result is nothing exciting, but it's important that you understand how to run your app before you start developing. Run on a Real Device If you have a real Android-powered device, here's how you can install and run your app: 1. Plug in your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document. 2. Enable USB debugging on your device.  On most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.  On Android 4.0 and newer, it's in Settings > Developer options.  Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options. To run the app from Eclipse: 1. Open one of your project's files and click Run from the toolbar. 2. In the Run as window that appears, select Android Application and click OK. Eclipse installs the app on your connected device and starts it. Or to run your app from a command line: 1. Change directories to the root of your Android project and execute: ant debug 5 Developing Android Apps 2. Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable, then execute: adb install bin/MyFirstApp-debug.apk 3. On your device, locate My First Activity and open it. That's how you build and run your Android app on a device! To start developing. Run on the Emulator Whether you're using Eclipse or the command line, to run your app on the emulator you need to first create anAndroid Virtual Device (AVD). An AVD is a device configuration for the Android emulator that allows you to model different devices. Figure 1. The AVD Manager showing a few virtual devices. To create an AVD: 1. Launch the Android Virtual Device Manager: a. In Eclipse, click Android Virtual Device Manager from the toolbar. b. From the command line, change directories to<sdk>/tools/ and execute: android avd 2. In the Android Virtual Device Manager panel, click New. 3. Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default). 4. Click Create AVD. 5. Select the new AVD from the Android Virtual Device Manager and click Start. 6. After the emulator boots up, unlock the emulator screen. To run the app from Eclipse: 1. Open one of your project's files and click Run from the toolbar. 2. In the Run as window that appears, select Android Application and click OK. Eclipse installs the app on your AVD and starts it. Or to run your app from the command line: 1. Change directories to the root of your Android project and execute: ant debug 2. Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable, then execute: adb install bin/MyFirstApp-debug.apk 3. On the emulator, locate MyFirstActivity and open it. 6 Developing Android Apps That's how you build and run your Android app on the emulator! To start developing. TESTING THE ANDROID APP Today there a number of ways in which we can wisely choose the most appropriate set of devices to test your app. Here are few of them: 1. Using statistics of Google Play Store to narrow down on the device parameters Android Developer site provides a plethora of information which if carefully analyzed can help us to concentrate on the most important aspects of the device world. Android OS versions: The android developer site publishes a bimonthly data on the relative number of devices running a given version of the Android platform. At the time of writing this article, following was the distribution of different Android versions across the world. So picking the three most popular versions of the OS according to the official Android website, it comes out that Gingerbread, ICS and Jelly Bean together constitute almost 95% of the OS landscape! Let's go further... Screen Sizes and Densities: Android divides the range of actual screen sizes and densities into several buckets as expressed by the table below: 7 Developing Android Apps Now, if we select the following screen size - density combinations, we can expect to cover at least 72% of the layout landscape: On merging the data set for OS versions and Screen sizes/densities, we can visualize the following combination of devices: The combinations suggested above is just one of the few ways in which we categorized the device combinations available; depending on the current device trends, similar 3 to 4 generalised combinations can be obtained. 2. Finding out the available devices in each of the generalised combinations. Many websites today keep a track of the latest devices as they flood into the market everyday and maintain a data repository about their hardware and software specifications. These can be used to get a list of devices which matches one of the generalized combinations of our need. For e.g., here is an indicative list from the Android market place, allowing users to slice & dice the available handsets on the basis of OS version, Carrier, Brand, Country, etc. 8 Developing Android Apps 3. Finding out the most relevant device(s) from the available list. Again, many data analytics companies use methods like surveys and polls to get information about the most popular devices, neatly categorized into device owner groups based on locales, age group, gender, etc. While many of these are paid, some are free to use. App publishers should make use of this data to finalize a device from each of the categories obtained in Step 1. CONCLUSION In this document we looked into the complexities of the Android ecosystem which calls for using multiple handsets to test our Android apps. These handsets should be intelligently chosen so as to strike a perfect balance between the device coverage for the app and the testing effort. Using Google Play Store Analytics we can categorize handsets according to different Android Versions, screen sizes and Screen densities. We can then use local demographic data to obtain a good spread of device manufacturers and carriers and find the most appropriate set of three to five handsets to optimise our testing efforts. The methods shown in the document can be further extended to increase device coverage depending on the company's resources. 9