Вы находитесь на странице: 1из 14

Android based solution for Indian agriculture Abstract: This is a project developed in order to help the farmers entitled

with Android based solution for Indian agriculture with android SDK as the front end tool and SQL database server service as the back end. The farmers can get the information regarding their agricultural plants, pesticides to use, and the orders that has been passed by the agricultural welfare department. These information are stored in the database using the SQL server. The user on using the application the help of an android application with using web service. Users can retrieve the information from our android based solution for Indian agriculture application database. Objectives: The objective of this application is to help the farmers at the next moment. This mobile application is focusing on to give information regarding the farmers need. Not only the need of the farmers, and also the information, rule and orders that are passed by the agricultural welfare department. This project focuses on reducing the stress on the information in their hands Existing System: Initially, if the farmers are wanted to grow a crop in their field, they need go the village agricultural centers to know the availability of seeds and then they buy. If any new rule and amendments were passed by the government for the welfare of the farmers that will be informed to the farmers slowly through public notice or communication. But there process was then converted in the form of web services to the farmers need the correct URL to connect with it. Disadvantages of Existing system: The user needs to have a computer to access the wed service. The users need to know the correct URL of the website People should go directly to the centers to get the seeds and information. Updating of information is not effective.

Proposed System: It is an application that helps the farmers. The availability of the seeds is stored in the database, the user can use the application to see the availability, and then go to centers to buy. If they are in need of any information, the farmer need not go directly to the centers; instead they can get the news in the place where they are. This helps in giving the updated information in the hands of the farmers. Advantage of Proposed System: Easy to access the application through mobile phone Reduces the manual work to a certain extent. Gives the updated information.

About Android: 1. Android 1.1 What is android? Android is basically an operating system for smartphones. But we find now integrated into PDAs, touch pads or televisions, even cars (trip computer) or netbooks. The OS was created by the start-up of the same name, which is owned by Google since 2005. 1.2 Specifications: This operating system is based on version 2.6 of Linux, so it has a monolithic system kernel, what means that all system functions and drivers are grouped into one block of code. Architecture: Android consists of five layers: -The Linux kernel 2.6-which includes useful drivers that allow for example WiFi or Bluetooth. -The library written in C and C + + that provide higher level functionality such as an HTML engine, or a database (SQLite). -A runtime environment for applications based on a virtual machine, made for inefficient machines such as telephones. The aim is to translate JAVA in machine language understood by Android. -A JAVA framework that allows applications running on the virtual machine to organize and cooperate. -The user applications written in Java (Web browser, contact manager etc. ...) Current Version Today android is in its 5th version, Android 2.1. Each version is designed to gradually correct the lack of APIs, to enhance the user interface and add functionality. The latest version adds such things as support in HTML5 in the browser, it allows multitouch or it brings new Contact API, which defines a database for contact management.

1.3 Characteristic of the market: Competitors -The principal competitor is iPhone OS. It is mainly for competing with Apple that Android has been created. -Palm OS devices on PDA. -Blackberry: which team the same name smartphones -Windows Mobile: which team smartphones and PDAs. -Symbian: Current Market Leader Key partners To help launch Android, Google has created an alliance of thirty companies in order to develop standards for mobile devices. There is, among others: -Operators such as NTT Dokomo, T-Mobile or Bouygues Telecom -Of-equipment manufacturers like Sony Ericsson or Samsug -Manufacturers of semiconductors, including Intel and Nvidia -Corporate businesses. Market share The android market share continues to increase since its inception, and is likely to continue climbing because it is favored by big players like HTC, Sony Ericsson, Samsung, LG, Motorola, Dell, Acer. Moreover, according to IDC, android will be the 2nd mobile

operating system used of the market in 2013. Here is the state of the market from 2006 to 2009. You have to know that the first mobile phone appeared in android date October 2008.

1.4 Why Android is better? Applications - Google applications Android includes most of the time many Google applications like Gmail, YouTube or Maps. These applications are delivered with the machine most of the time, except in certain cases, such as some phones running android on which the provider has replaced Google applications by its own applications. -widgets With android, it is possible to use widgets which are small tools that can most often get information. These widgets are directly visible on the main window. -Android Market This is an online software store to buy applications. Developers who created applications can add them into the store, and these applications can be downloaded by users, they can be both free and paid. Multitasking Android allows multitasking in the sense that multiple applications can run simultaneously. With Task Manager it is possible view all running tasks and to switch from one to another easily. SDK

A development kit has been put at disposal of everybody. Accordingly, any developer can create their own applications, or change the android platform. This kit contains a set of libraries, powerful tools for debugging and development, a phone emulator, thorough documentation, FAQs and tutorials. Modifiability: This allows everyone to use, improve or transform the functions of Android for example transform the interface in function of uses, to transform the platform in a real system embedded Linux. 1.5 The basics of creating applications To begin to program for Android I needed some basics, because some elements are very different, even if programming an application in Android uses the Java language, therefore, an object oriented language. Firstly, in an Android application, there is no main method: public static void main(String[] args){...} This method that allows to launch a program in java is not present in an application android. This example is only the first of a long list. So I'll try to explain what I had to learn to use to create my first application which is the Task Killer. Activity: An activity is a user interface that allows the user to interact with the screen, to perform actions. For example, a text messaging application could have an activity that displays a list of contacts to send messages. Once the contact is selected, activity could send information to a second activity that could serve to send the message to the contact. When an application is launched, what it displays is the result of an activity. At the code level, for create an activity, you must create a class that extends the Activity class. An activity has a required onCreate () method. It is the main method. To interact with the program, through the activity, there must be something displayed, that is why the activity, contains what is called views. View: A View is the basic building block for user interface components. A View occupies a rectangular area on the screen. View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.).There is differents kinds of views, for example a ListView is able to display only an interactive list of what you want to display, while a WebView allows you to to display a web page. As said before, A view occupies a rectangular area on the screen. To organise these rectangles on the screen, there is a text file written in XML for every different screen. Xml: Xml means Extensible Markup Language. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses. The goal of using Android's XML vocabulary, is to quickly design UI layouts and the screen elements they contain, in the same way that creating web pages in HTML : with a series of nested elements. Intent:

An activity can of course start another one, even if it but to do this, it will need a special object called Intent. An intent is basic description of an operation to be performed. It can launch an Activity, send a broadcastIntent to any interested BroadcastReceiver components, and communicate with a background Service. An Intent performs binding between the codes in different applications. It can be thought of as the link between activities. It is possible to add some informations to an Intent, thanks to an object called bundle, that you add to the intent thanks to the method : Intent.putExtras(Bundle objetbunble );

Android Manifest: AndroidManifest.xml file is necessary for all android applications and must have this name in its root directory. In the manifest you can find essential informations about the application for the Android system, informations that the system must have before it can run any of the application's code. Here is what you can find in the Android manifest: -The name of the Java package for the application. The package name serves as a unique identifier for the application. -The description of the components of the application: the activities, services, broadcast receivers, and content providers that the application is composed of and under what conditions they can be launched. -The processes that will host application components. -The permissions the application must have in order to access protected parts of the API and interact with other applications. -The permissions that others are required to have in order to interact with the application's components. -The list of the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they're removed before the application is published. -The minimum level of the Android API that the application requires. -The list of the libraries that the application must be linked against. Whit all these elements, an application can be created. So Ill explain my first application which was a Task Killer. 1.6 SQLite database system: Android uses SQLite database system. SQLiteOpenHelper is a helper class to manage database creation and version management. In the project, we need to build two databases classes extending SQLiteOpenHelper. They are LocalSightDatabase handling POIs data and MyTourDatabase handling data of tour plan. EventDataSQLHelper.java is attached in Appendix E and it is for building local sight database. SQLHandle.java is also seen in Appendix E and it is for adding sight data into local sight database and get data from local sight database.

2. Windows XP
The next major version of Windows, Windows XP, was released on October 25, 2001. The introduction of Windows XP aimed to unify the consumer-oriented Windows 9x series with the architecture introduced by Windows NT, a change which Microsoft promised would provide better performance over its DOS-based predecessors. Windows XP would also introduce a redesigned user interface (including an updated Start menu and a "task-oriented" Windows Explorer), streamlined multimedia and networking features, Internet Explorer 6, integration with Microsoft's .NET Passport services, modes to help provide compatibility with software designed for previous versions of Windows, and Remote Assistance functionality. At retail, Windows XP was now marketed in two main editions: the "Home" edition was targeted towards consumers, while the "Professional" edition was targeted towards business environments and power users, and included additional security and networking features. Home and Professional were later accompanied by the "Media Center" edition (designed for home theater PCs, with an emphasis on support for DVD playback, TV tuner cards, DVR functionality, and remote controls), and the "Tablet PC" edition (designed for mobile devices meeting its specifications for a tablet computer, with support for stylus pen input and additional pen-enabled applications). Mainstream support for Windows XP ended on April 14, 2009. Extended support will continue until April 8, 2014. After Windows 2000, Microsoft also changed its release schedules for server operating systems; the server counterpart of Windows XP, Windows Server 2003, was released in April 2003. It was followed in December 2005 by Windows Server 2003 R2.

2.1 Windows Vista, 7 and 8


After a lengthy development process, Windows Vista was released on November 30, 2006 for volume licensing and January 30, 2007 for consumers. It contained a number of new features, from a redesigned shell and user interface to significant technical changes, with a particular focus on security features. It was available in a number of different editions, and has been subject to some criticism. Vista's server counterpart, Windows Server 2008 was released in early 2008. On July 22, 2009, Windows 7 and Windows Server 2008 R2 were released as RTM (release to manufacturing) while the former was released to the public 3 months later on October 22, 2009. Unlike its predecessor, Windows Vista, which introduced a large number

of new featuresWindows 7 was intended to be a more focused, incremental upgrade to the Windows line, with the goal of being compatible with applications and hardware with which Windows Vista was already compatible. Windows 7 has multi-touch support, a redesigned Windows shell with an updated taskbar, a home networking system called Home Group and performance improvements. Windows 8, the successor to Windows 7, was released generally on October 28, 2012. A number of significant changes were made on Windows 8, including the introduction of a user interface based around Microsoft's Metro design language with optimizations for touchbased devices such as tablets and all-in-one PCs. These changes include the Start screen, which uses large tiles that are more convenient for touch interactions and allow for the display of continually updated information, and a new class of apps which are designed primarily for use on touch-based devices. Other changes include increased integration with cloud services and other online platforms (such as social networks and Microsoft's own SkyDrive and Xbox Live services), the Windows Store service for software distribution, and a new variant known as Windows RT for use on devices that utilize the ARM architecture. An update to Windows 8, called Windows 8.1, was released on October 17, 2013, and includes features such as new live tile sizes, deeper SkyDrive integration, and many other revisions. 3. Android automated testing 3.1 Android test strategy Automated testing of Android applications is especially important because of the huge variety of available devices. As it is not possible to test Android application on all possible device configurations, it is common practice to run Android test on typical device configurations. Having a reasonable test coverage for your Android application helps you to enhance and maintain the Android application. 3.1.1 How to test Android applications Android testing is based on JUnit. Testing for Android can be classified into tests which require only the JVM and tests which require the Android system.Which tests require an Android system is explained later in this book. If possible, you should prefer to run your unit tests directly on the JVM as the test execution is much faster compared to the time required to deploy and run the test on an Android device. 3.1.2 Unit tests vs. functional tests on Android A unit test tests only the functionality of a certain component.

Let's, for example, assume a button in an Android activity is used to start another activity. A unit test would determine if the corresponding intent was issued, not if the second activity was started. A functional test would also check if the activity was correctly started. 3.1.2 JUnit 3 Currently the Android testing API supports JUnit 3 and not JUnit 4. JUnit 3 requires that your test classes inherit from the JUnit 3 junit.framework.TestCase class. In JUnit 3 test methods must start with the test prefix. The setup method must be called setUp () and the final clean up method must be called tearDown(). 4. Areas to test: Activity life cycle events: You should test if you activity handles the Android life cycle events correctly. You should also test if the configuration change events are handled well and if instance state of your user interface components is restored. File system and database operations: Write and read access from and to the file system should be tested including the handling of databases. Different device configurations: You should also test if your application behaves well on different device configurations. 1.6. Testing preconditions It is good practice in Android testing to have one method called testPreconditions() which tests the pre-conditions for all other tests. If this method fails, you know immediately that the assumptions for the other tests have been violated. 4.1 User interface tests Android allows that only the main thread modifies the user interface. If a tests should run in the main thread you can annotate him with the @UIThreadTest annotation. These tests cannot be used to control the life cycle of components as they are executed in the same thread on the application under tests. If you have such tests and need to modify the user interface you have to use the Activity.runOnUiThread(Runnable) method. 4.2 Running tests on a server without display To run tests without a display (headless), specify the adb -no-window parameter. Which tests require an Android system to run? 4.3. Testing standard Java classes If your classes do not call the Android API, you can use the JUnit test framework without any restrictions.

The advantages of the method is that you can use any Java unit testing framework and utility as well as that the execution speed of the unit test is very fast compared to tests which require the Android system. 4.5. Testing Java classes which use the Android API If you want to test code which use the Android API, you need to run these tests on an Android device. Unfortunately, this makes the execution of tests take longer. This is because android.jar JAR file does not contain the Android framework code, but only stubs for the type signatures, methods, types, etc. The android.jar JAR file is only used for the Java compiler before deployment on an Android device. It is not bundled with your application. Once your application is deployed on the device, it will use the android.jar JAR file on the Android device. Calling methods from the android.jar JAR file throw a newRuntimeException("Stub!"). This makes it impossible to test the Android framework classes directly on the JVM without additional libraries. 5 Android test projects and running tests 5.1. Android test projects The preferred way of organizing tests is to keep them in separate Android test projects or source folders. The Android tooling for Eclipse emphasizes the usage of separate projects. Instead of Android components, an Android test application contains one or more test classes. The project under test must be added as dependency to the test project. The AndroidManifest.xml file must also specify that the test project uses the android test runner library and specifies the test runner for the unit test. A test project also specifies the package of the application to test in the AndroidManifest.xml file under the android: target Package attribute. The following listing shows an example AndroidManifest.xml for a test project. 5.2. Creating a test project The Android Developer Tools (ADT) provide support for the creation of Android test projects via a project creation wizard. This wizard can be reached under File New Other... Android Android Test Project. The wizard creates the required dependencies and entries in the AndroidManifest.xml file automatically. 5.3. Running tests To start an test from Eclipse, right-click on the test class and select Run As Android JUnit Test.

On the command line you can start tests via the ant test command. This requires that you created the build.xml file for the test project with the android update testproject command. 6. Mocking objects Android provides mock classes for the Android framework in the class and packages. These mock classes allow you to isolate tests from a running system by stubbing out or overriding normal operations. The following lists the most important mock objects which can be used for Android testing. MockApplication MockContext MockResources MockContentProvider MockContentResolver MockPackageManager All methods on these mock objects throws exceptions. If requried you can extend these mocks and override the required methods. 7. Application testing The application class contains the logic, data and settings which are relevant for the whole application. Therefore you should test this object, to ensure it works correctly. To test an Android application object you use the ApplicationTestCase class. 8. Service testing To test a service you use the ServiceTestCase class. It provides the startService() and bindService() methods to interact with the service. The bindService() immediately returns an IBinder object without callback. You also only need to provide an intent as input. Testing asynchronous processing in services is a challenge as the duration of this processing may vary. It is good practice to test if the service handles multiple calls from startService() correctly. Only the first call ofstartService() triggers the onCreate() of the service, but all calls trigger a call to onStartCommand() of the service.

9. Content provider testing To test a content provider, you use the ProviderTestCase2 class. ProviderTestCase2 automatically instantiates theprovider under test and inserts an IsolatedContext object which is isolated from the Android system, but still allows file and database access. The usage of the IsolatedContext object ensures that your provider test does not affect the real device. ProviderTestCase2 also provides access to a MockContentResolver via the getMockCOnktentResolver() method. You should test all operations of the provider and also what happens if the provider is called with an invalid URI or with an invalid projection. 10. Loader testing To test a loader, you use the LoaderTestCase class. 11. Test hooks into the Android framework 11.1. Instrumentation The Android testing API provides hooks into the Android component and application life cycle. These hooks are called the instrumentation API and allow your tests to control the life cycle and user interaction events. Under normal circumstances your application can only react to the life cycle and user interaction events. For example if Android creates your activity the onCreate() method is called on your activity. Or the user presses a button or a key and your corresponding code is called. Via instrumentation you can control these events via your tests. Only an instrumentation-based test class allows you to send key events (or touch events) to the application under test. For example, your test can call the getActivity() method which starts an activity and returns the activity under test. Afterwards, you can call the finish() method, followed by a getActivity() method call again and you can test if the application restored its state correctly. The Android instrumentation API allows you to run the test project and the normal Android project in the same process so that the test project can call methods of the Android project directly. 11.2. How the Android system executes tests The InstrumentationTestRunner is the base test runner for Android tests. This test runner starts and loads the test methods. Via the instrumentation API it communicates with

the Android system. If you start a test for an Android application, the Android system kills any process of the application under test and then loads a new instance. It does not start the application, this is the responsibility of the test methods. The test method controls the life cycle of the components of the application. The test runner also calls the onCreate() method of the application and activity under test during its initialization. 12. Activity testing 12.1. Life cycle of activities and instrumentation As you use instrumentation to test activities, its life cycle methods are not called automatically, only its onCreate()method is called if you call the startActivity() method. You can call the other methods directly via thegetInstrumentation().callActivityOn* helper methods. 12.2. Unit tests for activities To test an activity in isolation, you can use the ActivityUnitTestCase class. This class allows you to check the layout of the activity and to check if intents are triggered as planned. The intent is not sent to the Android system, but you can use the getStartedActivityIntent() method to access a potential intent and validate its data. ActivityUnitTestCase starts the activity in an IsolatedContext, i.e., mainly isolated from the Android system. ActivityUnitTestCase can be used to test layouts and isolated methods in the activity . As this test runs in an IsolatedContext, the test must start the activity , i.e., it is not auto-started by the Android system. Intent intent = new Intent(getInstrumentation().getTargetContext(), MainActivity.class); startActivity(intent, null, null);

12.3. Integration tests for activities Functional tests for an activity can be written with the ActivityInstrumentationTestCase2 class. This test uses the full Android system infrastructure and allows you to interact with different components. The communication with the Android infrastructure is done via the Instrumentation class which can be accessed via the getInstrumentation()method. This class allows you to send keyboard and click events.

If you prefer to set values directly, you need to use the runOnUiThread() of the activity. If all statements in your method interact with the UI thread, you can also use the @UiThreadTest annotation on the method. In this case you are not allowed to use methods which do not run in the main UI thread. A test based on ActivityInstrumentationTestCase2 starts the activity in the standard Android context, similar as if a user would start the application. If you want to send key events via your test, you have to turn off the touch mode in the emulator viasetActivityInitialTouchMode(false) in your setup() method of the test. 12.4. Testing the initial state It is good practice to test the initial state of the application before the main activity start to be sure that the test conditions for the activity are fulfilled. 12.5. State management tests You should write tests which verify that the state of an activity remains even if it is paused or terminated by the Android system. The ActivityInstrumentationTestCase2 class uses the Instrumentation class, which allows you to call the life cycle hooks of the activities directly. For example you can call the onPause() and onDestroy() method, followed by anonCreate() to validate that the state 13. Exercise: unit test for an activity 13.1. Create project which is tested Create a new Android project called com .android.test.simpleactivity with the activity called MainActivity. Add a second activity called SecondActivity to your project. This activity should use a layout with at least oneTextView. The id of the TextView should be "resultText" and its text should be set to "Started". Add an EditText field to the layout of the MainActivity class. Add a button to the layout used by MainActivity. If this button is clicked, the second activity should be started.

Вам также может понравиться