You are on page 1of 88

Unit-VI

Working with data storage and


Publishing Apps
6.1 Shared Preferences
Android SharedPreferences
• It allows us a framework that helps in saving and retrieving persistent
key-value pairs of primitive datatypes. So remember the limitations of
using Android SharedPreferences, it only allows primitive data types.
The values are saved even when the application is killed.
When to use SharedPreferences?
• As the name suggests, it is used to store preferences, i.e., user-specific
data, like settings, login sessions, etc. You may find this Login and
Registration helpful where we are using SharedPreferences to
maintain a user Login Session.
SharedPref
6.2 Preferences activity
We will build a preference screen using the PreferenceActivity class.
Our main activity will contain 2 Buttons and a TextView. One of the
buttons will open the preference screen, and the other will display the
values stored in SharedPreferences.
We will be using the PreferenceActivity class. The good thing about this
class is that the definition of layout file it’s very simple.
It provides custom controls specially designed for preference screens.
Another good thing is that you don’t need to write code to save the
values from preference screen to SharedPreferences.
All this work is done automatically by the activity.
• 1. Create a new project in Eclipse:
Project: PreferenceDemoTest
Activity: PreferenceDemoActivity
• 2. Create a new Android XML file prefs.xml in the folder res/xml/.
This file will contain the layout for our preference screen:
• Notice that the root element of prefs.xml is
the <PreferenceScreen> element, and not a RelativeLayout or
LinearLayout for example. When a PreferenceActivity points to this layout
file, the <PreferenceScreen> is used as the root, and the contained
preferences are shown.
• <PreferenceCategory> – defines a preference category. In our example the
preference screen is split in two categories: “Login Information” and
“Settings”
• <EditTextPreference> – defines a text field for storing text information.
• <CheckBoxPreference> – defines a checkbox.
• <ListPreference> – defines a list of elements. The list appears as group of
radio buttons.

• 3. At this stage the prefs.xml might complain that
the @array/listOptions and @array/listValues resources cannot be found.
• To fix this create a new XML file array.xml in the folder res/values/. This
file will contain the elements of the ListPreference.
6.3 Files access
FileAccessDemo2
6.4 SQLite database
• https://sqlitebrowser.org/dl/

• FOR “db browser for sqlite”

• Program Name: SqlDemo.java


• For Create and Insert
6.5 Preparing for publishing
• Android App Bundle
• APK
if using Android App Bundle then app size will be small, if use APK then
size will be big.
• The “Key Store Path” is used if you update app further, that time it
will ask the key store path.
• Fill it with password and all required contents.
6.6 Signing and preparing the graphics
and
6.7 Publishing to the Android Market
• Step 1: Sign up
• Sign up for an account on the Android Developer Console. Creating an
account costs $25.
• Step 2: Create a new application
• On the Developer Console select the Publish an Android
Application option.
• Fill out the details: Title, Short Description, Full Description.
Prerequisite of Submitting App To Play Store
Step-by-Step Process to Upload App To Google
Play Store
• In order to upload a mobile app to Google Play Store, a developer
dashboard is imperative. Developer console is kind of a backend
controlling center, from where developers submit an app to Play Store.
There is a one-time fee of $25 by which a developer can open an
account, loaded with functions and control features. After paying this
one-time fee, you can upload apps to Google Play Store for free.
• You need to fill out all the credentials asked while creating the
account, such as your name, country and more. Once you submit your
account it will take upto 48 hours to get approved.
• If the app getting uploaded to Play Store supports in-app purchases,
then you will need a merchant account. To create one you can sign in
to your Google Console account and click on ‘Reports’ followed
by ‘Financial Reports’ option. After this, you may select ‘Set up a
merchant account now’ option and simply fill out your details.
• The merchant account will automatically get linked to your Google
Console account and will allow you to manage and examine app sales.
• Now, you are required to use the files such as App bundle or APK and signed app
release and upload them into your application. This is how you do it: Navigate to
the ‘Release Management’ and then ‘App Release’ tab in the menu. After this,
you will be asked to choose any one type of release from four options- internal
test, close test, production release, and an open test.
• Once, you have made a decision regarding which type of release you want, you
may select ‘Create Release’.
• At this point, you will be redirected to the New release to the production page.
Here, you are again required to make another decision- to opt for Google Play app
signing on the app or not. If you choose the latter, then simply click on the ‘OPT-
OUT’ option.
• Now, select ‘Browse files’ and then look into how to upload apk to google
play store while naming and describing your release through on-screen
instructions. You can also click on ‘Review’ to confirm the information. When
everything is taken care of, press ‘Save’.
• The next step regarding how to publish apps on the Play Store is to rate
your app. This is crucial for it is listed as ‘Unrated’, it might get removed
altogether from the store, so it is imperative to rate the application.
• For Content Rating, you must again navigate to the menu on the left side of
the screen and then select the same. By clicking on ‘Continue’ you can
move forward and then type your email address in the respective field and
then ‘Confirm’ it.
• Now, you may fill the questionnaire for your app rating. Follow this by
selecting the ‘Save Questionnaire’ and then choose the ‘Calculate
Rating’ option to see your app rating on the Play Store. The last thing to
finalize your app’s content rating is to click on ‘Apply’.
• Now, you have to be clear about what countries your app is going to be available
in. The point to note here is that Google doesn’t support publishing an app for all
regions. The app will be published in selected countries instead of world-wide.
• Moreover, assigning a price to your app is crucial. If you want your app to be free,
make sure that this decision is permanent, as Google does not allow you to convert
free apps into paid ones. Although, the price of the app can be altered.
• To do all this, go to the Pricing and Distribution tab in the menu, and then make
a choice whether your app is going to be Free or Paid. You may now select the
countries you want your app to be released. Additionally, if your application is
suited for children under the age of 13, you may select the option of ‘Yes’ for
Primary Child-Detected. If otherwise is the case, simply select ‘No’. Similarly,
select the options for allowing ads into your application.
• Once you are confirmed about everything being correct, take the last step of
this guide on how to upload an app on Play Store, i.e, add the application to
the platform. You need to go back to the ‘App Releases’ tab and then select
‘Manage Production’ followed by ‘Edit Release’. After this, click on
‘Review’ and then choose ‘Start rollout to production’ option. To bring this
process to an end select the ‘Confirm’ option and Voila! You have
successfully uploaded the app to the Google Play Store for free.
• All there is left to do now is to just wait for your application to get
approved. It generally took about two hours for your application to get
reviewed. But with Google Play’s updated privacy policy, it will now take
hours and even days for the same, encouraging mobile app development
companies to create even more flawless applications that get selected
instantly. So, hold your excitement in the place and just wait.
How To Get Your App Featured On Play Store?
• Your job to make sure the app gains popularity and thousands of
downloads doesn’t end here. After successful execution of the steps
regarding how to upload an app to Google Play Store, it is now time
to get it featured on Play Store.
• There are certain practices such as user interaction and visual design
services, working on the latest technologies, localization, etc. that
helps your app to get featured. Getting featured on Google Play can
benefit your app to an extent that it increases the attention of users on
your app by multi-folds.
Thank you….!

You might also like