Code Monkey home page Code Monkey logo

bsc-mobile's Introduction

bsc-new

This repo contains the project for the mobile app Alarmed whose purpose is to demonstrate the utility of the tensorflow model which recognizes drawn fruits.

About

The following lines represent an excerpt from my Bachelor's Thesis. All rights reserved 😄

4.4 Android Application

The name of the application that I created is ’Alarmed’. The reason why I decided to create an Android Application is that Android is considered to be the most used operating system in the world, more and more people deciding to buy an Android-powered device over other alternatives.

Class diagram

4.4.1 Kotlin

There are several reasons why I decided to use the Kotlin programming language for developing the Android app. Kotlin is an object-oriented and open-source programming language for Android and JVM alike. It targets the Java platform, being focused on interoperability with Java code. It is concise, safe and pragmatic, while also having the same level of performance as Java. Java is, and has been for a while, a widely used programming language. However, there are specific shortcomings when dealing with it, which can be easily overcome by switching over to Kotlin. Programming in the latter is done more concisely, with increased efficiency and productivity than programming in Java. In addition, using Kotlin is also safer due to a couple of reasons. For instance, Kotlin is statically typed, in contrast with Java. This leads to increased performance, as well as several other improvements. The increased performance is due to the fact that methods can be called faster since the program does not have to figure out what methods are to be called at runtime, whereas in dynamically typed languages, the program also has to use some time for this aspect. Programs that are written in Kotlin are bound to be shorter and help the programmer with running into fewer annoyances, due to less boilerplate code, which represents a big issue in Java.

Another notable aspect of Kotlin is its type system, which makes the code more reliable by introducing support for nullable types. Java programs are sometimes prone to crashing due to NullPointerException errors, which are easily avoidable in Kotlin since it converts these runtime errors to compile time errors. This leads to fewer runtime errors and fewer program crashes. In other words, nullable types allow the programmer to indicate what variables or properties in a program are allowed to be null [21].

4.4.2 About the Application

The application itself has two activities: MainActivity and DrawingActivity. The first one consists of a tabbed ViewPager, where each tab is a fragment. In the first fragment, the user can add new alarms. The alarms can go off once only or they can be recurring, depending on the option that the user chooses. In the second tab, a list of all the alarms is made available. The third tab is similar to the DrawingActivity functionality-wise. However, when making predictions in the third tab, the user will receive two predictions. This structure of the application can be observed in the class diagram that is featured in Figure 4.12.

Sequence diagram

As mentioned before, the model that is integrated into the application is a lightweight version of the original model generated by the neural network. I wanted to experiment more with observing the differences between these two versions of the same model. In order to see what each of them would predict, I decided to integrate the option of making predictions with the original model in the application. In order to do this, I used Flask, which is a Python microframework used for writing web applications. I wrote a server using this framework for handling the requests from the mobile application. When the user draws something in the third tab of the app, i.e., the ’Play mode’, they will also make a request to this server with the drawing they have made. The image is sent to the server, and it responds with the corresponding prediction it made using the .h5 model. When setting an alarm, a PendingIntent is created for the DrawingActivity. The PendingIntent encapsulates an intent for the aforementioned activity and it is going to occur in the future, at the time that the user set for the alarm. Thus, the DrawingActivity will start at a specific time and it will ask the user to draw something in order to stop ringing. This whole mechanism is possible due to Android’s BroadcastReceiver, which is used for handling such situations. The operations that are made available to the user of the application can be observed in the use case diagram from Figure 4.13. As mentioned before, the user can add or remove alarms, view them and, of course, draw something to make an alarm stop ringing, as well as freely experiment with the drawing feature. Also, in Figure 4.14 I presented the interactions that happen between the user and the components of the application when a new alarm is added.

© 2019 Bianca Dragomir. All rights reserved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.