Android app installation
This chapter covers Setting Consumer Key & Secret Key, Facebook Integration, Google Integration, Rename Package (Optional) and Import App into Android Studio.
Import App into Android Studio#
After CMS installation, please follow below given instructions to set up your mobile application..
4.1) – Getting Started
Download and install all latest tools, required for developing Android apps such as Java Development Kit and Android Studio as the Official Android IDE. For updated tutorial about how to install them, you can see and Download this from Android Developer website. Download JDK Download Android studio IDE
4.2) – Android Studio Setting
There are three main things interacting when you use Android Studio to create android applications.
· The code you write in Java or Kotlin to create interactive android apps · Android Studio itself, an IDE that provides you with a nice interface for coding · Android SDK, a selection of tools including the Android platform itself
Now you can click on Android Studio to launch it. Once it opens up, you’ll be presented with a menu where you’ll be able to get started or configure some options. The great thing is that everything is handled for you at this point, though you may want to familiarize yourself with the SDK Manager (Configure > SDK Manager) which is where you’ll update your Android SDK to support newer versions, as well as download things like code samples or support for Google Glass. But don’t worry about that now but if Android Studio says you’re missing something, this is where you’ll probably need to go to find it.
4.3) – Open up Project in Android Studio
Locate your Android app in the given project .zip folder and extract it somewhere in your computer.
Once Android studio ready, click open an existing android studio project.
Browse to directory where you placed the android project and click Open after selecting the root directory of project.
While opening up the project you will get a popup like this. please click OK to building the project.
After this android studio will download some of the packages and execute some gradle plugins into your project.
Note: This may take some time to compile.
While importing your android app you may get some dependencies errors. to resolve that you just need to update versions of libraries or dependencies.
After every thing is done. your android studio project will look like this. you may ignore the plugin update if it recommends that.
Note: if you want to update your gradle plugin that may need to change some deep source code. It is better to user the same version of plugin.
Project directory structure looks like this. your all Kotlin source code is placed under the following package.
we only need constants/AppConfig.java file to attach our backend.
AppConfig file looks like this.
Setting Consumer Key & Secret Key#
Go to Admin Panel > Business Settings > Consumer Keys · Click Generate to create your Consumer Key and Consumer Secret. · Copy your Consumer Key and Consumer Secret.
· Open AppConfig in android studio app · Place your Backend URL, Consumer Key and Consumer Secret here.
Facebook Integration#
This link will take you to the Facebook Developer Console. After login with your Facebook account you will get a screen mention below. Enter your project name into the Edit Text Field and click Create New Facebook App ID. You will get a screen like this. Skip that Import SDK Step and jump to Add SDK and copy that Facebook app ID and keep it safe. In the Android Project section paste your application package name in package name text field and your (application package name)+.activities.SplashScreen in you Default Activity Class Name text field and click Next. In the next step you need to generate a key hash. Keep in mind there are two methods for generating the developmental key hash and release key hash.
Key Hash For Windows#
In order to generate the key hash first you need to download the OpenSSL(for windows) tool. To download that for windows go to this link below.
Download OpenSSL tool compatible with your system and extract it to C:OpenSSL. Next you need to find the path of debug.keystore file in the C drive usually it is placed in the C:UsersYOUR_NAME.android folder. Now open the Command Prompt. and execute the following command.
Note: For Debugging (use it for development purpose only.) keytool -exportcert -alias androiddebugkey -keystore “C:UsersYOUR_NAME.androiddebug.keystore” | “C:OpenSSLbinopenssl” sha1 -binary |”C:OpenSSLbinopenssl” base64
**Note:**For Publishing use this command keytool -exportcert -alias “aliasName” -keystore “keystoreFilePath” | openssl sha1 -binary | openssl base64M
Note: remember to change the path to you debug.keystore file. and make it sure to use the OpenSSL folder name same as you created in the C drive. when you press enter this will get a password. If you do not create a new password, then default password will be android
Key Hash For Mac#
Please follow below mention steps to get hash key for mac OS First open a terminal (open a command prompt in windows). Navigate in the terminal to the directory where your Android debug.keystore is stored. Mostly it will located under /Users/user_name/.android/ Once you are in the “.android” directory, run the following command. keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64 When it prompts you for a password, type android and hit Enter Copy the value printed in the terminal that ends with an = and paste it in the Key Hash field in Facebook. Then click the Save Changes button. This is your key hash save it to your file and use it in developer Facebook console. Now paste the application key to the android studio project file shown below as facebook_app_id. (res > values > strings.xml) Now to get fb_login_protocol_scheme first go to your facebook app settings and in facebook login section select Quickstart and then select android In the Edit Your Resource and Manifest section you can get fb_login_protocol_scheme. Just copy and save it.
Google Integration#
Official link of google login for Android
You need Google Cliend ID key
Add these key in below screen shot from prject
File path is res/values/strings/string.xml
Rename Package (Optional)#
Lets Say you want to change the android app package name from com.xyz.something to the com.xyz.newapp. to do that follow the steps given below. ⦁ First open the Project Structure window in the android studio project by pressing CTR+ALT+SHIFT+S and under the app -> Flavour tab change the application id to the new application package name and hit OK
Next go to the AndroidMenifest.xml file and change the application package name to the new one.
Next go to the Firebase Project and delete the previous app and create a new one with new android package name
to add new app to the Firebase Project click on android icon.
Next enter new credentials into the required fields.
to get the new SHA-1 key execute a file shown in the image bellow by double click on it.
copy the SHA-1 key from here.
and paste it in the Firebase Project here. and hit Register App.
Next download the google-services.xml file from here.
next change the android studio project view to the project.
and move the downloaded google-services.xml file here in the app directory as shown in the image bellow.
hit Overwrite button.
Next also change the package name in the google projects, google cloud platform to the new one.
In the developer.facebook.com under the settings -> basic settings – > change the application id and application secret to the new one
after changing it to new one hit save changes.
Other Source Code Customization#
Here is all the ui and resources files under the res package.
anim all the animations used in the activity transitions are placed here. drawable folder contains all the media resources file like icons, logos and other stuff. layout folder contains all the ui screens and layout files related to ui. menu this folder contains the menu files like action bar menu and bottom navigation menu. mipmap this folder contains the launcher icon for the application. values folder contains all types of values like all the constant string, integers, pixels, dimension etc used in the project.
You are free to customize as you want you application.