Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 35

CONTENT

Title Page No.

Chapter 1 1

1. Android OS 1-8
1.1 Introduction to Android 1
1.2 History of Android 2
1.3 Features of Android 2
1. Quicker access to settings 3
2. A standard depth formats 3
3. An improved Files App 4
4. Overhauled permissions 4
5. Wi-Fi sharing via QR codes 4
6. Gestures, app drawers play nicely 5
7. Google assistant handles 5
8. Hearing aids get streaming support 5
9. Security updates via play store 5
10. Wet, overheating USB warnings 6
1.4 Android Architecture 6
1. Linux Kernel 7
2. Libraries 7
3. Android Libraries 7
4. Android Runtime 8
5. Application Framework 8
6. Application 8
8

Chapter 2 9

2. Android Studio 9-14


2.1 Introduction to Android Studio 9
2.2 Features of Android Studio 10
1. Instant App Run 10
2. Visual Layout Editor 10
3. Fast Emulator 11
4. Intelligence code editor 11
5. Addition of new activity as a code template 11
6. Help to build up app for all devices 11
7. Help to connect with firebase 11
8. Support KOTLIN 12
9. Colour previews 12
10. Maven repository 12
2.3 Components in Android Studio 12
1) Activities 13
2) Services 13
3) Content providers 13
4) Intents 13
5) Broadcast Receivers 14
6) Widgets 14
7) Notifications 14
2.4 Android Studio Requirements 14

Chapter 3 15

3. Activity and Firebase 15-20


3.1 Android activity lifecycle 15
3.2 Introduction to firebase 17
3.3 Services provided by firebase 18
1. Google Analytics 17
2. Firebase Cloud Messaging 17
3. Firebase Auth 19
4. Firebase Realtime Database 19
5. Cloud Firestore 19
6. Firebase Storage 19
7. Firebase hosting 20
8. ML kit 20

Chapter 4 21

4. Global Storage 21-29


4.1 Introduction to Global Storage 21
4.2 Snapshots 21
4.3 Sample Code 26

Chapter 5 30

Conclusion 30
References 31

FIGURE CONTENT
Sr. No. Figure No. Figure Name Page No.

1 1.1 Android 1

2 1.2 Android Features 3

3 1.3 Architecture of Android 7

4 2.1 Android Versions 9

5 2.2 Android Versions 10

6 2.3 Android Studio Components 12

7 3.1 Activity Lifecycle in Android Studio 15

8 3.2 Introduction to Firebase 17

9 3.3 Services of Firebase 18

10 4.1 Module 1 21

11 4.2 Module 2 22

12 4.3 Module 3 22

13 4.4 Module 4 23

14 4.5 Module 5 23

15 4.6 Module 6 24

16 4.7 Module 7 24

17 4.8 Module 8 25

18 4.9 Module 9 25
Global Storage 2019-2020

CHAPTER 1
Android OS
1.1 Introduction to Android
Android is a mobile operating system based on a modified version of the
Linux kernel and other open source software, designed primarily for touchscreen
mobile devices such as smartphones and tablets. Android is developed by a
consortium of developers known as the Open Handset Alliance, with the main
contributor and commercial marketer being Google.

Fig: 1.1 Android

Initially developed by Android Inc., which Google bought in 2005, Android


was unveiled in 2007, with the first commercial Android device launched in
September 2008. The current stable version is Android 10, released on September 3,
2019. The core Android source code is known as Android Open Source Project
(AOSP), which is primarily licensed under the Apache License. This has allowed
variants of Android to be developed on a range of other electronics, such as game
consoles, digital cameras, PCs and others, each with a specialized user interface.
Some well-known derivatives include Android TV for televisions and Wear OS for
wearables, both developed by Google.
Android's source code has been used as the basis of different ecosystems,
most notably that of Google which is associated with a suite of proprietary software
called Google Mobile Services (GMS), that frequently comes pre-installed on said
devices. This includes core apps such as Gmail, the digital distribution platform
Google Play and associated Google Play Services development platform, and usually
apps such as the Google Chrome web browser. These apps are licensed by

1 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

manufacturers of Android devices certified under standards imposed by Google.


Other competing Android ecosystems include Amazon.com's Fire OS, or
LineageOS. Software distribution is generally offered through proprietary
application stores like Google Play Store or Samsung Galaxy Store, or open source
platforms like Aptoide or F-Droid, which use software packages in the APK format.
Android has been the best-selling OS worldwide on smartphones since 2011
and on tablets since 2013. As of May 2017, it has over two billion monthly active
users, the largest installed base of any operating system, and as of January 2020, the
Google Play Store features over 2.9 million apps.

1.2 History of Android


The history and versions of android are interesting to know. The code names
of android ranges from A to J currently, such as Aestro, Blender, Cupcake, Donut,
Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, Jelly Bean, KitKat
and Lollipop. Let's understand the android history in a sequence.

1) Initially, Andy Rubin founded Android Incorporation in Palo Alto,


California, United States in October, 2003.
2) In 17th August 2005, Google acquired android Incorporation. Since then, it is
in the subsidiary of Google Incorporation.
3) The key employees of Android Incorporation are Andy Rubin, Rich Miner,
Chris White and Nick Sears.
4) Originally intended for camera but shifted to smart phones later because of
low market for camera only.
5) Android is the nick name of Andy Rubin given by coworkers because of his love
to robots.
6) In 2007, Google announces the development of android OS.
7) In 2008, HTC launched the first android mobile.

1.3 Features of Android


Google is on Something-Android is now more Popular than iOS or the
Windows phone. The OS Tends To Garner rave Reviews fir its ease of use and open
source, nut many iOS or Windows phone users argue that their preferred operating
system can do just as much. In some respect, that’s true, but here are 10 features

2 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

unique to Android’s OS.

Fig: 1.2 Android Features

1) Quicker access to settings


android q connectivity settings in apps. It’s already super easy to toggle
Wi-Fi, Bluetooth, and other connectivity options, but Google is making this
process a little easier when you’re in apps. Enter the settings panel.
This new popup window can be summoned by apps in certain situations.
Google gives the example of launching a browser when in airplane mode. The
browser can now tell users to activate Wi-Fi, then automatically summon the
settings panel.

2) A standard depth formats


Android 10 also brings a new depth format, dubbed (surprise) the
Dynamic Depth Format, and it opens the door for depth-editing in loads of third-
party apps.
Starting in Android 10 “apps can request a Dynamic Depth image which
consists of a JPEG, XMP metadata related to depth related elements, and a depth

3 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

and confidence map embedded in the same file on devices that advertise support,”
reads an excerpt of the Android Developers Blog. Google confirmed that
Facebook is one such app making use of depth data on the Pixel 4.
Google also confirmed that the new format will let third-party apps tweak
depth data to create “specialized blurs and bokeh options.” Hopefully, third-party
developers embrace this new, Google-pushed standard.

3) An improved Files app


The Google Files app in Android 10. Google’s previous Files app was a
no-frills affair, and it didn’t even have a shortcut in the app drawer. Fortunately,
the Android 10 Files app is a step above the previous version.
Not only does the new app have a shortcut, but it also offers a revised UI,
a universal search bar at the top, and quick access to other apps.

4) Overhauled permissions
Menu of various Android app permissions. Android 10 also has plenty of
privacy-related tweaks, with roles being one of the biggest additions in this
regard. With roles, the platform can now automatically grant specific permissions
to an app based on its use-case. So a text messaging app would automatically gain
the ability to send/receive texts, as well as access to your contacts.
Another major change is a tweak affecting location permissions. Now,
users have the option to either grant location access in general to an app, or only
allowing access when the app is actively being used.

5) Wi-Fi sharing via QR codes


Android Q Wifi sharing via QR code Xiaomi and Huawei smartphones
have allowed users to share Wi-Fi credentials via QR codes for a long time now.
So, we’re glad to see Google adopt this trend with the new Android update.
The feature is easy to use, as you tap on your Wi-Fi connection, hit the
share button, then authenticate with your phone’s password or a fingerprint. From
here, you should see a QR code, and your friend can scan this code to gain access.
Again, it’s nothing new for third-party brands, but we’re happy Google is
catching up in this regard.

4 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

6) Gestures, app drawers play nicely


Android Q Beta 5 Peeking. The early Android 10 previews introduced
more comprehensive gesture navigation, such as sliding your finger inwards from
the screen edge to go back. Unfortunately, this gesture didn’t work well in apps
with navigation drawers/menus. This meant users wanting to see these overflow
menus might accidentally activate the back gesture instead.
Fortunately, Android 10 has a so-called “peek” feature to solve the issue.
Now, users wanting to see an app’s navigation drawer/overflow menu need to
swipe in and hold for a second. Once you see the menu “peek” out (see image
above), you can continue the swipe gesture to fully reveal it.

7) Google Assistant ‘handles’


Android Q Beta 5 Google Assistant Handles. The switch to gesture
navigation means that you can no longer activate the Google Assistant via the
home button. You can however activate the assistant via an inward swipe from the
lower corners of your screen on Android 10.
This activation method isn’t obvious though, so Google has added visual
cues in the form of Google Assistant “handles” in the corners (seen above).
Hopefully this subtle addition eases confusion about Assistant’s activation in
Android 10.

8) Hearing aids get streaming support


Android Bluetooth Notification Menu Icon Google is also bringing
another nifty accessibility feature to Android 10, allowing users to stream music
via Bluetooth to their hearing aids.
According to Engadget, the feature uses the new Audio Streaming for
Hearing Aids protocol (ASHA) to stream music, calls, and other audio from a
Pixel phone.
The feature is reportedly compatible with the Pixel 3 and Pixel 3a series
for now, but Google is open-sourcing the platform. So hopefully we quickly see
more phones and hearing aids offering this truly useful function.

5 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

9) Security updates via Play Store


Twitter for Android Play Store Updates. Another major initiative coming
to Android 10 is Project Mainline, an effort by Google to deliver some security
updates via the Play Store.
This significantly reduces the waiting time for security updates in theory,
as you don’t have to wait for your operator to approve the update. Furthermore, it
shouldn’t require a lengthy installation process, working in a similar manner to
app updates.
The only real downside to this solution is that some security
vulnerabilities can’t be patched in this fashion, necessitating a traditional security
update anyway. But it’s definitely a major step in the right direction.
Qualcomm has also announced that phones equipped with its 2020
chipsets will let you update graphics drivers via the Play Store. It’s believed that
this is due to Project Mainline as well. This is definitely one of the coolest
Android 10 features if you have a supported phone.

10) Wet, overheating USB warnings


Android 10’s release has also seen XDA uncover evidence of new USB-
related functionality in the update. More specifically, the operating system will
now display a warning when your USB port is wet. Any connected accessories
will also be disabled until you either manually enable them or until the phone
detects that the port is no longer wet.
Furthermore, the latest Android update will also issue a warning if your
USB port is overheating. You’ll still need to unplug your phone from the charger
or USB cable of course, but the warning is welcomed nonetheless.

1.4 Android Architecture


Android architecture is a software stack of components to support mobile
device needs. Android software stack contains a Linux Kernel, collection of c/c++
libraries which are exposed through an application framework services, runtime, and
application.
In these components, the Linux Kernel is the main component in android to
provide its operating system functions to mobile and Dalvik Virtual Machine (DVM)
which is responsible for running a mobile application.

6 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

Following is the pictorial representation of android architecture with different


components.

Fig 1.3 Architecture of Android

1) Linux Kernel
At the bottom of the layers is Linux - Linux 3.6 with approximately 115
patches. This provides a level of abstraction between the device hardware and it
contains all the essential hardware drivers like camera, keypad, display etc

2) Libraries
On top of Linux kernel there is a set of libraries including open-source
Web browser engine WebKit, well known library libc, SQLite database which is a
useful repository for storage and sharing of application data, libraries to play and
record audio and video, SSL libraries responsible for Internet security etc.

3) Android Libraries
This category encompasses those Java-based libraries that are specific to
Android development. Examples of libraries in this category include the

7 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

application framework libraries in addition to those that facilitate user interface


building, graphics drawing and database access.

4) Android Runtime
This is the third section of the architecture and available on the second
layer from the bottom. This section provides a key component called Dalvik
Virtual Machine which is a kind of Java Virtual Machine specially designed and
optimized for Android.
The Dalvik VM makes use of Linux core features like memory
management and multi-threading, which is intrinsic in the Java language. The
Dalvik VM enables every Android application to run in its own process, with its
own instance of the Dalvik virtual machine

5) Application Framework
The Application Framework layer provides many higher-level services to
applications in the form of Java classes. Application developers are allowed to
make use of these services in their applications.
The Android framework includes the following key services –
a) Activity Manager: - Controls all aspects of the application lifecycle and
activity stack.
b) Content Providers: - Allows applications to publish and share data with other
applications.
c) Resource Manager: - Provides access to non-code embedded resources such
as strings, color settings and user interface layouts.
d) Notifications Manager: - Allows applications to display alerts and
notifications to the user.
e) View System: - An extensible set of views used to create application user
interfaces.

6) Application
You will find all the Android application at the top layer. You will write
your application to be installed on this layer only. Examples of such applications
are Contacts Books, Browser, and Games etc.

8 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

CHAPTER 2
Android Studio
2.1 Introduction to Android Studio
Android Studio is the official integrated development environment (IDE) for
Google's Android operating system, built on JetBrains' IntelliJ IDEA software and
designed specifically for Android development.[8] It is available for download on
Windows, macOS and Linux based operating systems. It is a replacement for the
Eclipse Android Development Tools (ADT) as the primary IDE for native Android
application development.

Fig 2.1: Android Versions

Android Studio was announced on May 16, 2013 at the Google I/O
conference. It was in early access preview stage starting from version 0.1 in May
2013, then entered beta stage starting from version 0.8 which was released in June
2014. The first stable build was released in December 2014, starting from version
1.0.
On May 7, 2019, Kotlin replaced Java as Google’s preferred language for
Android app development. Java is still supported, as is C++.

9 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

2.2 Features of Android Studio


Android the name which is more popular these days. And one who is
acquiring training in Android Development course should be awared with the top
latest features of Android Studio on which we are going to discuss today.

Fig 2.2: Android Versions

Everyone knows about Android but must be don't know on which the android
application builds professionally, I will help you in this, Android applications build
on Android Studio the setup developed by Google.
In coming years, Android Developer will be on demand as per the stats by
the end of 2020.
Now, let us start the count-down for features of Android Studio-
1) Instant App Run
It is an advanced technology in which it cleverly understands the
transmutations done in the applications and deliver it instantly without taking time
to rebuild the apk and installations make. So, quick that you can see the changes
in app immediately. This is done by launching the URL on Android application
installing the native libraries with Android Instant apps. Instant App sometimes is
known as " New Module Wizard".

2) Visual Layout Editor


Layout editor helps to build the layout quickly by adding different
attributes either by hard-code or drag and drop. The preview of the codes can be
seen easily on the visual editor screen and changes can be made accordingly by
resizing it dynamically. This will make testing the application process more facile
and more exhaustive.

10 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

3) Fast Emulator
Android has a great feature of Emulator which is exactly like the android
phones to test how the application looks like in physical devices. It gives real-
time experience to the Android applications. It allows you to test your
applications faster and on different-different configuration devices like tablet,
android phone etc. It helps you to make your application development life cycle
shorter and more efficient.

4) Intelligence Code Editor


Android Studio provides you with the intelligent and quick code editor.
This will help you and guide you with the accurate code. It helps you to complete
code in advance and analyse your code in advance before building. Android
studio has the special feature of the development of code by the drop-down list
with suggesting the code you can integrate.

5) Addition of New Activity as a Code Template


Yes, Android also has the feature of templates built-in. If you know to
build that accordingly that makes your task easier. it has both pros and cons, you
don't find every template in Android Studio. It's an additional feature which helps
the developer to build an application efficiently and effectively which provide
effective solutions.

6) Help to Build Up App for All Devices


Android studio builds applications for every screen size, for wear and gear
devices etc. It also can stimulate the various type of features which a hardware
has like GPS location tracker, multi-touch.

7) Help to Connect with Firebase


Android Studio helps to give real-time experience with IOT based project
development with dynamic upgrades in the application.
Firebase connectivity help to create direct updates and provide databases
connectivity. To build high-quality applications we must use Firebase
connectivity it helps to build the scalable infrastructure for building the
application. You can create chat applications by using firebase connectivity it
helps you to do happy chat experience.

11 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

8) Support KOTLIN
Kotlin the official language can be considered for Android. It is a
language without having any new restrictions and has various advantages in it.
The great feature of Kotlin is it run without any disturbances in older android
versions as well that means no issues of specific android versions. It runs fast and
equivalent to Java. Java developers can easily hands-on Kotlin with no-issues
because it based on automated Java only.

9) Colour Previews
Android studio helps to see the code XML part in a preview to know that
how perfectly we are designing the application according to the need before
launching the application. It provides powerful functionality and enhanced
features of drag and drops or resizes the application. It contains drag and drop
features but not support for every function, that's why be careful while doing that.

10) Maven Repository


In Android Studio, Maven integration of its repository can be done, within
SDK manager support libraries of IDE is used. It’s a kind of a repository which
is a directory in which various jar files like project jars, Plugin are stored.

2.3 Components in Android Studio

Fig 2.3: Android Studio Components

12 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

There are some necessary building blocks that an Android application


consists of. These loosely coupled components are bound by the application manifest
file which contains description of each component and how they interact. The
manifest file also contains the app’s metadata, its hardware configuration and
platform requirements, external libraries and required permissions.
There are the following main components of an android app: -

1) Activities
Activities are said to be the presentation layer of our applications. The UI
of our application is built around one or more extensions of the Activity class. By
using Fragments and Views, activities set the layout and display the output and
also respond to the user actions. An activity is implemented as a subclass of class
Activity.

2) Services
These are like invisible workers of our app. These components run at
backend, updating your data sources and Activities, triggering Notification and
also broadcast Intents. They also perform some tasks when applications are not
active. A service can be used as a subclass of class Service.

3) Content Providers
It is used to manage and persist the application data also typically interact
with SQL database. They are also responsible for sharing the data beyond the
application boundaries. The Content Providers of a particular application can be
configured to allow access from other applications, and the Content Providers
exposed by other applications can also be configured.

4) Intents
It is a powerful inter-application message-passing framework. They are
extensively used throughout Android. Intents can be used to start and stop
Activities and Services, to broadcast messages system-wide or to an explicit
Activity, Service or Broadcast Receiver or to request an action be performed on a
particular piece of data.

13 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

5) Broadcast Receivers
They are known to be intent listeners as they enable your application to
listen the Intents that satisfy the matching criteria specified by us. Broadcast
Receivers make our application to react to any received Intent thereby making
them perfect for creating event driven applications.

6) Widgets
These are the small visual application components that you can find on the
home screen of the devices. They are special variation of Broadcast Receivers that
allow us to create dynamic, interactive application components for users to embed
on their Home Screen. They are generally used to grab user’s attention when the
application is not visible or active, particularly from within a Service or Broadcast
Receiver.

7) Notifications
Notifications are the application alerts that are used to draw user’s
attention to some particular app event without stealing focus or interrupting the
current Activity of the user. They are generally used to grab user’s attention when
the application is not visible or active, particularly from within a Service or
Broadcast Receiver. Examples: E-mail popups, Messenger popups etc.

2.4 Android Studio Requirements: -


You will be delighted, to know that you can start your Android application
development on either of the following operating systems −

1) Microsoft® Windows® 10/8/7/Vista/2003 (32 or 64-bit)


2) Mac® OS X® 10.8.5 or higher, up to 10.9 (Mavericks)
3) GNOME or KDE desktop

Second point is that all the required tools to develop Android applications are
open source and can be downloaded from the Web. Following is the list of software's
you will need before you start your Android application programming.

1) Java JDK5 or later version


2) Java Runtime Environment (JRE) 6
3) Android Studio

14 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

CHAPTER 3
Activity and Firebase
3.1 Android Activity Lifecycle
Android Activity Lifecycle is controlled by 7 methods of android app.
Activity class android Activity is the subclass of Context Theme Wrapper class. An
activity is the single screen in android. It is like window or frame of Java. By the
help of activity, you can place all your UI components or widgets in a single screen.

Fig 3.1: Activity Lifecycle in Android Studio

15 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

1) onCreate()
implement this callback, which fires when the system first creates the
activity. On activity creation, the activity enters the Created state. In the
onCreate() method, you perform basic application startup logic that should
happen only once for the entire life of the activity. For example, your
implementation of onCreate() might bind data to lists, associate the activity with a
View Model, and instantiate some class-scope variables.

2) onStart()
When the activity enters the Started state, the system invokes this
callback. The on Start() call makes the activity visible to the user, as the app
prepares for the activity to enter the foreground and become interactive. For
example, this method is where the app initializes the code that maintains the UI.

3) onPause()
The system calls this method as the first indication that the user is leaving
your activity (though it does not always mean the activity is being destroyed); it
indicates that the activity is no longer in the foreground (though it may still be
visible if the user is in multi-window mode.

4) onStop()
When your activity is no longer visible to the user, it has entered the
Stopped state, and the system invokes the onStop() callback. This may occur, for
example, when a newly launched activity covers the entire screen. The system
may also call

5) onDestroy()
When the activity moves to the destroyed state, any lifecycle-aware
component tied to the activity's lifecycle will receive the ON_DESTROY event.
This is where the lifecycle components can clean up anything it needs to before
the Activity is destroyed.

6) onResume()
When the activity enters the Resumed state, it comes to the foreground,
and then the system invokes the onResume() callback. This is the state in which

16 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

the app interacts with the user. The app stays in this state until something happens
to take focus away from the app. Such an event might be, for instance, receiving a
phone call, the user’s navigating to another activity, or the device screen’s turning
off.

7) onRestart()
There are a few scenarios in which your activity is destroyed due to
normal app behaviour, such as when the user presses the Back button or your
activity signals its own destruction by calling the finish().

3.2 Introduction to Firebase


Firebase is a mobile and web application development platform developed by
Firebase, Inc. in 2011, then acquired by Google in 2014. As of March 2020, the
Firebase platform has 19 products, which are used more than 1.5 million apps
including 9GAG.

Fig 3.2: Introduction to Firebase

If you’re the enterprising sort of person that tackles humanity’s urgent needs
with a mobile app, you’ll want to know about Firebase. Firebase is Google’s mobile
application development platform that helps you build, improve, and grow your app.
Firebase is a toolset to “build, improve, and grow your app”, and the tools it gives
you cover a large portion of the services that developers would normally have to
build themselves, but don’t really want to build, because they’d rather be focusing

17 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

on the app experience itself. This includes things like analytics, authentication,
databases, configuration, file storage, push messaging, and the list goes on. The
services are hosted in the cloud, and scale with little to no effort on the part of the
developer.
When I say “hosted in the cloud”, I mean that the products have backend
components that are fully maintained and operated by Google. Client SDKs provided
by Firebase interact with these backend services directly, with no need to establish
any middleware between your app and the service. So, if you’re using one of the
Firebase database options, you typically write code to query the database in your
client app.
This is different than traditional app development, which typically involves
writing both frontend and backend software. The frontend code just invokes API
endpoints exposed by the backend, and the backend code actually does the work.
However, with Firebase products, the traditional backend is bypassed, putting the
work into the client. Administrative access to each of these products is provided by
the Firebase console.

3.3 Services Provided by Firebase

Fig 3.3: Services of Firebase

18 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

1) Google Analytics
Google Analytics is a cost-free app measurement solution that provides
insights on app usage and user engagement.

2) Firebase Cloud Messaging


Formerly known as Google Cloud Messaging (GCM), Firebase Cloud
Messaging (FCM) is a cross-platform solution for messages and notifications for
Android, iOS, and web applications, which as of 2016 can be used at no cost.

3) Firebase Auth
Firebase Auth is a service that can authenticate users using only client-side
code. It supports social login providers Facebook, GitHub, Twitter and Google
(and Google Play Games). Additionally, it includes a user management system
whereby developers can enable user authentication with email and password login
stored with Firebase.

4) Firebase Realtime Database


Firebase provides a real-time database and back-end as a service. The
service provides application developers an API that allows application data to be
synchronized across clients and stored on Firebase's cloud. The company provides
client libraries that enable integration with Android, iOS, JavaScript, Java,
Objective-C, Swift and Node.js applications. The database is also accessible
through a REST API and bindings for several JavaScript frameworks such as
AngularJS, React, Ember.js and Backbone.js. The REST API uses the Server-Sent
Events protocol, which is an API for creating HTTP connections for receiving
push notifications from a server. Developers using the Realtime database can
secure their data by using the company's server-side-enforced security rules.

5) Cloud Firestore
On January 31, 2019, Cloud Firestore was officially brought out of beta,
making it an official product of the Firebase lineup. It is the successor to
Firebase's original databasing system, Real-time Database, and allows for nested
documents and fields rather than the tree-view provided in the Real-time
Database.

19 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

6) Firebase Storage
Firebase Storage provides secure file uploads and downloads for Firebase
apps, regardless of network quality, to be used for storing images, audio, video, or
other user-generated content. It is backed by Google Cloud Storage.

7) Firebase Hosting
Firebase Hosting is a static and dynamic web hosting service that launched
on May 13, 2014. It supports hosting static files such as CSS, HTML, JavaScript
and other files, as well as support through Cloud Functions. The service delivers
files over a content delivery network (CDN) through HTTP Secure (HTTPS) and
Secure Sockets Layer encryption (SSL). Firebase partners with Fastly, a CDN, to
provide the CDN backing Firebase Hosting. The company states that Firebase
Hosting grew out of customer requests; developers were using Firebase for its
real-time database but needed a place to host their content.

8) ML Kit
ML Kit is a mobile machine learning system for developers launched on
May 8, 2018, in beta during the Google I/O 2018. ML Kit APIs feature a variety
of features including optical character recognition, detecting faces, scanning
barcodes, labelling images and recognising landmarks. It is currently available for
iOS or Android developers. You may also import your own TensorFlow Lite
models, if the given APIs are not enough. The APIs can be used on-device or on-
cloud.

20 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

CHAPTER 4
Global Storage
4.1 Introduction to Global Storage
The Global Storage is the online database on which you can upload the
documents, photos, songs and many more files online. The documents are uploaded
at firebase database and when user select the document and press on upload button
the document start upload to the firebase database. After document is uploaded user
can view that document from any corner of world from Global Storage because of
this the user does not have to full his memory he can just upload the document and
delete that document from device.

4.2 Snapshots

Fig 4.1: Module 1

21 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

Fig 4.2: Module 2

Fig 4.3: Module 3

22 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

Fig 4.4: Module 4

Fig 4.5: Module 5

23 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

Fig 4.6: Module 6

Fig 4.7: Module 7

24 G. H. Raisoni Polytechnic,
Global Storage 2019-2020

Fig 4.8: Module 8

Fig 4.9: Module 9

25 G. H. Raisoni Polytechnic,
Global Storage 2019-

4.3 Sample Code


package import
com.example.myglobalstorage; com.google.firebase.auth.Firebase
import Auth;
android.app.ProgressDialog; import
import com.google.firebase.database.Data
android.content.ContentResolver; baseReference;
import android.content.Intent; import
import android.net.Uri; com.google.firebase.database.Fireb
import android.os.Bundle; aseDatabase;
import android.view.Menu; import
import android.view.MenuInflater; com.google.firebase.storage.Fireba
import android.view.MenuItem; seStorage;
import android.view.View; import
import com.google.firebase.storage.Storag
android.webkit.MimeTypeMap; eReference;
import android.widget.TextView; import
import android.widget.Toast; com.google.firebase.storage.Uploa
import dTask;
com.google.android.gms.tasks.Con import java.util.HashMap;
tinuation; import
import androidx.annotation.NonNull;
com.google.android.gms.tasks.On import
CompleteListener; androidx.annotation.Nullable;
import import
com.google.android.gms.tasks.OnF androidx.appcompat.app.AppCom
ailureListener; patActivity;
import public class FilesActivity extends
com.google.android.gms.tasks.Tas AppCompatActivity
k; {
import TextView urlData;
com.google.android.material.floati FirebaseStorage storage;
ngactionbutton.FloatingActionButt FirebaseAuth auth;
on;
26 G. H. Raisoni Polytechnic, Jalgaon.
Global Storage 2019-

StorageReference storageRef, });


imageRef; }
ProgressDialog progressDialog; private void uploadFiles() {
UploadTask uploadTask; Intent intent = new
Uri uriImage; Intent(Intent.ACTION_GET_CON
FloatingActionButton upload; TENT);
DatabaseReference ref; intent.setType("*/*");
@Override startActivityForResult(intent,
protected void onCreate(Bundle 1);
savedInstanceState) { }
@Override
super.onCreate(savedInstanceState protected void
); onActivityResult(int requestCode,
int resultCode, @Nullable Intent
setContentView(R.layout.activity_ data) {
filesActivity);
storage = super.onActivityResult(requestCod
FirebaseStorage.getInstance(); e, resultCode, data);
storageRef = switch (requestCode) {
storage.getReference(); case 1:
auth = if (resultCode ==
FirebaseAuth.getInstance(); RESULT_OK) {
upload = uriImage =
findViewById(R.id.uploadBtn); data.getData();
urlData = //UploadData();
findViewById(R.id.urlTv); uploadImage();
}
upload.setOnClickListener(new }
View.OnClickListener() { }
@Override private String
public void onClick(View getFileExtension(Uri uri) {
v) { ContentResolver
uploadFiles(); contentResolver =
} getContentResolver();
27 G. H. Raisoni Polytechnic, Jalgaon.
Global Storage 2019-

MimeTypeMap if (!
mimeTypeMap = task.isSuccessful()) {
MimeTypeMap.getSingleton(); throw
return task.getException();
mimeTypeMap.getExtensionFrom }
MimeType(contentResolver.getTy return
pe(uri)); fileReference.getDownloadUrl();
} }
private void uploadImage() {
final ProgressDialog pd }).addOnCompleteListener(new
= OnCompleteListener<Uri>() {
new ProgressDialog(this); @Override
pd.setMessage("Uploading"); public void
pd.setCancelable(false); onComplete(@NonNull
pd.show(); Task<Uri> task) {
if (uriImage != null) { if (task.isSuccessful())
final StorageReference {
fileReference = Uri downloadUri =
storageRef.child(System.currentTi task.getResult();
meMillis() String mUri =
+ "." + downloadUri.toString();
getFileExtension(uriImage)); ref =
uploadTask = FirebaseDatabase.getInstance().get
fileReference.putFile(uriImage); Reference("Storage_Links").child(
auth.getUid());
uploadTask.continueWithTask(ne HashMap<String,
w Object> map = new HashMap<>();
Continuation<UploadTask.TaskSn
apshot, Task<Uri>>() { map.put("imageURL", "" + mUri);
@Override
public Task<Uri> urlData.setText(mUri);
then(@NonNull
Task<UploadTask.TaskSnapshot> ref.child(ref.push().getKey()).updat
task) throws Exception { eChildren(map);

28 G. H. Raisoni Polytechnic, Jalgaon.


Global Storage 2019-

pd.dismiss();
} else { //inflater.inflate(R.menu.menu,men
u);
Toast.makeText(FilesActivity.this, //inflater.inflate(R.menun.menu,me
"Failed!", nu);
Toast.LENGTH_SHORT).show(); //nflater.inflate(R.me);
pd.dismiss(); return true;
} }
} @Override
}).addOnFailureListener(new public boolean
OnFailureListener() { onOptionsItemSelected(MenuItem
@Override item)
public void {
onFailure(@NonNull Exception e) switch (item.getItemId())
{ {
Toast.makeText(FilesActivity.this, case R.id.item1 :
e.getMessage(), signOut(); }
Toast.LENGTH_SHORT).show(); return
pd.dismiss(); super.onOptionsItemSelected(item
} ); }
}); private void signOut() {
} else { auth.signOut();
Toast.makeText(FilesActivity.this, Toast.makeText(this, "Sign
"No image selected", Out Successful",
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} } Intent intent=new
@Override Intent(FilesActivity.this,MainActiv
public boolean ity.class);
onCreateOptionsMenu(Menu intent.addFlags(Intent.FLAG_ACT
menu) { IVITY_CLEAR_TASK |
MenuInflater inflater = Intent.FLAG_ACTIVITY_NEW_
getMenuInflater(); TASK);
startActivity(intent);
}}
29 G. H. Raisoni Polytechnic, Jalgaon.
Global Storage 2019-

CHAPTER 5
Conclusion
My Project and implementation are on Global Storage in Android application. I
have successfully completed it. I take this opportunity to express our sense of
independents and gratitude to all those people who helped me in completing this project
and implementation. I have successfully completed my Micro-Project on my Project
Topic Global Storage as the guidance of our subject teacher properly.
I have successfully completed Global Storage with the help of my teacher.
Because of this project opportunity I have taught all the Basic android studio and also
Development in android. Android studio is very important part of my project because the
entire development is done on it.

30 G. H. Raisoni Polytechnic,
Global Storage 2019-

REFERENCES

1] Introduction to Android
https://en.wikipedia.org/wiki/Android_(operating_system)

2] History of Android
https://www.javatpoint.com/android-history-and-versions

3] Features of android
https://www.androidauthority.com/android-10-features-944275/

4] Android Architecture
https://www.tutorialspoint.com/android/android_architecture.htm

5] Introduction to Android Studio


https://developer.android.com/guide/components/activities/activity-
lifecycle

6] Features of android studio


https://www.admecindia.co.in/blog/top-10-features-android-studio-
developers-not-miss

7] Components of android
https://www.wideskills.com/android/overview-

8] Android studio Requirements


https://www.tutorialspoint.com/android/android_studio.htm

9] Android Activity Lifecycle


https://www.javatpoint.com/android-life-cycle-of-activity

10] Introduction to Firebase


https://medium.com/firebase-developers/what-is-firebase-the-complete-
story-abridged-bcc730c5f2c0

11] Link To download android Studio


https://developer.android.com/studio

31 G. H. Raisoni Polytechnic,

You might also like