<<

INTERNATIONAL RESEARCH JOURNAL OF AND TECHNOLOGY (IRJET) E-ISSN: 2395-0056 VOLUME: 07 ISSUE: 06 | JUNE 2020 WWW.IRJET.NET P-ISSN: 2395-0072

Android Application on MVVM to Change Nagaraj M1, Chethana G2 1,2Department of Electronics and Communication, RV College of Engineering, Bangalore. ------***------Abstract- The main objective of this app is to provide 2. PROBLEM STATEMENT premium account and app upgradation facility and to get the details of the users of that app enable and monthly develop the android Class App using MVVM Architecture reports using MVVM architecture. Personalised and KOIN dependency to avoid lagging and replace the performance reports for all the users of the batch and Chat Dagger 2 with the same so that We can develop a user- facility, anytime, anywhere. Disable chat when you’re busy, friendly App easily create their Control what info your service provider Tools App helps the non-technical employees to get and admin can view for your batches online courses and about students, , and sell on their mobile app. some other facilities like is tutorsOBJECTIVES secured using AES 256bit encryption of courses providing maximum security, manage your application completely The objective of this project is to create a user- digitally. simplify the above work managing app is made friendly app that provides useful information about users which upgrades the app to new version and activation of such as student, tutor and . premium account is done through this app. A literature survey was done on works on apps created Key Words: MVVM, KOIN, API using mvvm architecture. Some of them are listed below.

1. INTRODUCTION In [1], The study results aim to bring more clarity in the Android is a powerful operating and it variety of MVVM design patterns and help practitioners to supports a large number of applications in Smartphones. make better grounded decisions when selecting patterns. These applications are more comfortable and advanced for users. The hardware that supports android is In [2], This research provided some recommended based on the ARM architecture platform. The android is an solutions to satisfy the relations between MVVM objects in open-source operating system that means that it’s free and the project. Activity designed in [1], with MVVM design anyone can use it. The android has got millions of apps pattern for Android development is introduced and MVVM available that can help you manage your life one or another Framework, principle and advantage are also studied in way and it is available to low cost in the market for that detail. reason android is very popular. In [3], Shifting from dagger2 to KOIN dependency API or Application Programming Interface is essentially injection, pragmatic lightweight dependency injection how our app communicates with the Android operating framework for Kotlin developers. Written in pure Kotlin system. API is what allows us to build our apps so they can using functional resolution only: no proxy, no code run on android devices. Now as with everything over time generation, no reflection. new features are developed and old features refined and sometimes products are completely revamped. In [4], Android AlertDialog can be used to display the dialog message with OK and Cancel buttons. It can be used Maintaining the larger database is difficult so api’s are used to interrupt and ask the user about his/her choice to to change the database and update the new things and continue or discontinue. allow other changes to the database that can done easily using MVVM architecture and some dependency injection In [5], Google otp 2-Step Verification provides stronger so that UI can be changed frequently without changing the security for our Google Account by requiring a second base code verification step when you sign in. In addition to our password, we’ll also need a code generated by the Google Authentication app on our phone. Platform and they can provide ratings based on the quality.

3. MVVM ARCHITECTURE SETUP MVVM was designed to make use of data binding functions in WPF (Windows Presentation Foundation) to better facilitate the separation of view layer development from the rest of the pattern, by removing virtually all GUI code (”code-behind”) from the view layer. Instead of requiring user experience (UX) developers to write GUI code, they can use the framework markup language (e.g., © 2020, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1465 INTERNATIONAL RESEARCH JOURNAL OF ENGINEERING AND TECHNOLOGY (IRJET) E-ISSN: 2395-0056 VOLUME: 07 ISSUE: 06 | JUNE 2020 WWW.IRJET.NET P-ISSN: 2395-0072

XML) and create data bindings to the view model, which is Data : Declarative data and command-binding are implicit written and maintained by application developers. The in the MVVM pattern. In the Microsoft solution stack, the separation of roles allows interactive designers to focus on binder is a markup language called XML. The binder frees UX needs rather than programming of business logic. The the developer from being obliged to write boiler-plate logic layers of an application can thus be developed in multiple to synchronize the view model and view. When work streams for higher productivity. Even when a single implemented outside of the Microsoft stack, the presence developer works on the entire code base, a proper of a declarative data binding technology is what makes this separation of the view from the model is more productive, pattern possible, and without a binder, one would typically as user interface typically changes frequently and late in use MVP or MVC instead and have to write more the development cycle based on end-user feedback. The boilerplate (or generate it with some other tool). MVVM pattern attempts to gain both advantages of separation of functional development provided by MVC, 4. API SETUP AND DATA FETCHING while leveraging the advantages of data bindings and the Web APIs are the defined interfaces through framework by binding data as close to the pure application which interactions happen between an enterprise and model as possible. It uses the binder, view model, and any applications that use its assets, which also is a Service business layers’ data-checking features to validate Level Agreement (SLA) to specify the functional provider incoming data. The result is that the model and framework and expose the service path or URL for its API users. An drive as much of the operations as possible, eliminating or API approach is an architectural approach that revolves minimizing application logic which directly manipulates around providing a program interface to a set of services the view. to different applications serving different types of consumers. When used in the context of web development, an API is typically defined as a set of specifications, such as Hypertext Transfer Protocol (HTTP) request messages, along with a definition of the structure of response messages, usually in an Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format. An example might be a shipping company.

Fig. 3.1 Crop Database 1

Model : Model refers either to a domain model, which represents real state content (an object oriented approach), or to the data access layer, which represents content (a data-centric approach).View, As in the model- view-controller (MVC) and model-view-presenter (MVP) patterns, the view is the structure, layout, and appearance of what a user sees on the screen. It displays a representation of the model and receives the user’s interaction with the view (clicks, keyboard, gestures, etc.), Fig.4.1: Api architecture to fetch the data and it forwards the handling of these to the view model via the data binding (properties, event callbacks, etc.) that is API that can be added to an eCommerce-focused website to defined to link facilitate ordering shipping services and automatically include current shipping rates, without the site developer View Model : The view model is an abstraction of the view having to enter the shipper’s rate table into a web exposing public properties and commands. Instead of the database. While ”web API” historically has been virtually controller of the MVC pattern, or the presenter of the MVP synonymous with web service, the recent trend (so-called pattern, MVVM has a binder, which automates Web 2.0) has been moving away from Simple Object Access communication between the view and its bound properties Protocol (SOAP) based web services and service-oriented in the view model. The view model has been described as a architecture (SOA) towards more direct representational state of the data in the model. The main difference between state transfer (REST) style web resources and resource- the view model and the Presenter in the MVP pattern, is oriented architecture (ROA). Part of this trend is related to that the presenter has a reference to a view whereas the the Semantic Web movement toward Resource Description view model does not. Instead, a view directly binds to Framework (RDF), a concept to promote web-based properties on the view model to send and receive updates. technologies. Web API’s allow the To function efficiently, this requires a binding technology combination of multiple API’s into new applications known as or generating boilerplate code to do the binding the view mashups. In the social media space, web API’s have allowed web and view model. communities to facilitate sharing content and data between communities and applications. In this way, content that is created

© 2020, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1466 INTERNATIONAL RESEARCH JOURNAL OF ENGINEERING AND TECHNOLOGY (IRJET) E-ISSN: 2395-0056 VOLUME: 07 ISSUE: 06 | JUNE 2020 WWW.IRJET.NET P-ISSN: 2395-0072 in one place dynamically can be posted and updated to multiple have consistent behaviour across the widest range of locations on the web. For example, Twitter’s REST API allows devices. For example, the Toolbar widget provides a developers to access core Twitter data and the Search API provides material design experience on devices running Android 2.1 methods for developers to interact with Twitter Search and trends (API level 7) or later, but the native action bar doesn’t data support material design unless the device is running

Android 5.0 (API level 21) or later. Once you set the A. ui design toolbar as an activity’s app bar, you have access to the App bar In its most basic form, the action bar displays the various utility methods provided by the v7 appcompat title for the activity on one side and an overflow menu on support library’s ActionBar class. This approach lets you the other. Even in this simple form, the app bar provides do a number of useful things, like hide and show the app useful information to the users, and helps to give Android bar. To use the ActionBar utility methods, call the activity’s apps a consistent look and feel. As Shown in fig 4.2 getSupportActionBar() method. This method returns a Beginning with Android 3.0 (API level 11), all activities reference to an appcompat ActionBar object. Once you that use the default theme have an ActionBar as an app bar. have that reference, you can call any of the ActionBar However, app bar features have gradually been added to methods to adjust the app bar. For example, to hide the the native ActionBar over various Android releases. As a app bar, call ActionBar.hide(). result, the native ActionBar behaves differently depending Dialog box on what version of the Android system a device may be A dialog is a small window that prompts the user to make a using. By contrast, the most recent features are added to decision or enter additional information. A dialog does not the support library’s version of Toolbar, and they are fill the screen and is normally used for modal events that available on any device that can use the support library. require users to take an action before they can proceed. For this reason, you should use the support library’s The Dialog class is the base class for dialogs, but you Toolbar class to implement your activities’ app bars. Using should avoid instantiating Dialog directly. Instead, use one the support library’s toolbar helps ensure that your app of the following sub classes: AlertDialog: A dialog that can will In the admin form, once login credentials are entered, show a title, up to three buttons, a list of selectable items, there will be a page in which he can enter a new crop and or a custom layout its parameter values or edit an already entered crop in the database. This data from the webpage is to be stored in the database. So, this will be processed through PHP and JavaScript.

Fig.4.3: dialog box for confirmation

DatePickerDialog or TimePickerDialog: A dialog with a pre- defined UI that allows the user to select a date or time. Fig 4.3 define the style and structure for your dialog, but you should use a Dialog Fragment as a container for your dialog. The Dialog Fragment class provides all the controls Fig. 4.2: Toolbar setup you need to create your dialog and manage its appearance,

instead of calling methods on the Dialog object. Using Dialog Fragment to manage the dialog ensures that it correctly handles lifecycle events such as when the user presses the Back button or rotates the screen. The Dialog Fragment class also allows you to reuse the dialog’s UI as an embedded component in a larger UI, just like a traditional Fragment (such as when you want the dialog UI to appear differently on large and small screens).

© 2020, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1467 INTERNATIONAL RESEARCH JOURNAL OF ENGINEERING AND TECHNOLOGY (IRJET) E-ISSN: 2395-0056 VOLUME: 07 ISSUE: 06 | JUNE 2020 WWW.IRJET.NET P-ISSN: 2395-0072

5. RESULTS AND DISCUSSION Here, organization code is entered as Arecanut in figure 7.3 The figure 5.1 shows the Home page having which will fetch all the parameters related to that options for a login. The user will have to enter the gmail to organisation. The page will appear as shown in figure 7.3 access the app features, thus anybody who has an access to the app can obtain the information of users they are looking for. The Admin will have to login through Gmail because he will be having access to the main database to which he can add a new user or update an existing one. Thus, security is provided to the database as well as made user-friendly to the customers.

Fig. 7.1: Home page

The Figure 7.2 shows the Mobile number Entry after which he will be directed to user information in viewpager shown in figure 7.2 itself. User can get details of the person as shown in figure temperature would be displayed.

Fig. 7.3: org info output

To add new number old number and org details has to be added and future updates will come to new number., as shown in [8] will help the admin to manage number changes.

Fig. 7.2: getting user details

© 2020, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1468 INTERNATIONAL RESEARCH JOURNAL OF ENGINEERING AND TECHNOLOGY (IRJET) E-ISSN: 2395-0056 VOLUME: 07 ISSUE: 06 | JUNE 2020 WWW.IRJET.NET P-ISSN: 2395-0072

Ms. Netravati, professor of RV College of Engineering for providing their valuable feedback.

8. REFERENCES [1] X. Li, D. Chang, H. Pen, X. Zhang, Y. Liu, and Y. Yao, “Application of mvvm design pattern in mes,” in 2015 IEEE International Conference on Cyber Technology in Automation, Control, and Intelligent (CYBER), 2015, pp. 1374–1378. [2] A. Syromiatnikov and D. Weyns, “A journey through the land of model-view-design patterns,” in 2014 IEEE/IFIP Conference on , 2014, pp. 21– 30. [3] K. Jeˇzek, L. Holy´, and P. Brada, “Dependency injection refined by extra-functional properties,” in 2012 IEEE Symposium on Visual Languages and Human- Centric Computing (VL/HCC), 2012, pp. 255–256. [4] T. Limpiti, S. Khamyan, S. Chumsaeng, and N. Puttarak, “A smart dialogue box for the hearing impaired,” in 2019 5th International Conference on Engineering, Applied Sciences and Technology (ICEAST), 2019, pp. 1–4. [5] M. H. Eldefrawy, K. Alghathbar, and M. K. Khan, “Otp- based two-factor authentication using mobile phones,” in 2011 Eighth International Conference on : New Generations, 2011, pp. 327–331.

[6] B. S. Pochampally and J. Liu, “A secure tracking mobile Fig. 7.5: change mobile number app development,” in 2017 12th IEEE Conference on 6. CONCLUSION Industrial Electronics and Applications (ICIEA), IEEE, Jun. MVVM pattern is a guidance architecture pattern 2017. doi: 10.1109/iciea.2017.8282926 for designing and developing complex applications to [7] Prathibha S R, Anupama Hongal, Jyothi M P “IOT achieve better reusability, maintainability and extensibility Based Monitoring System in Smart Agriculture” 2017 with low degree of coupling. We should avoid using MVVM International Conference on Recent Advances in pattern for simple applications. Electronics and Communication Technology (ICRAECT). 16-17 March 2017, 81-84. 10.1109/ICRAECT.2017.52.. [8] M. F. A. Samsudin, R. Mohamad, S. I. Suliman, N. M. Anas and KOIN dependency injection helps us to increase our H. Mohamad, "Implementation of wireless temperature and productivity with Kotlin. Rx-java helps us by handling the humidity monitoring on an embedded device," 2018 IEEE cache without creating caching classes, combining the Symposium on Computer Applications & Industrial Electronics reception of requests and results processing and getting (ISCAIE), Penang, 2018, pp. 90-95, doi: rid of standard AsyncTask, decreasing memory leak by 10.1109/ISCAIE.2018.8405450. 90%,optimizing the code to increase an application response, making methods easier to combine premium BIOGRAPHY account and app upgradation provides additional features Nagaraj M, which improves product efficiency. other details related BE final year, tabs provide easy access to user solutions. Dept. of Electronics and Communication, One of the ways to optimize the design is by doing with RV College of Engineering. MVVM architecture by dividing the complete design into separate parts. Multiple times UI can be changed without Ms. Chethana G disturbing the main code. Migration can be done from Assistant Professor, mvvm to others when there are new updates available in Dept. of Electronics and the market. New features can be added without changing Communication, the present version of the application. RV College of Engineering.

7. ACKNOWLEDGEMENT

The authors thank Ms. Chethana G for providing excellent guidance in carrying out the work. We also thank

© 2020, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1469