Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Android Google Maps

You're reading from   Learning Android Google Maps Integrate Google Maps with your Android application to offer feature-rich and interactive maps

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher Packt
ISBN-13 9781849698863
Length 356 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Setting Up the Development Environment 2. Configuring an API Key and Creating Our First Map Application FREE CHAPTER 3. Working with Different Map Types 4. Adding Information to Maps 5. Interacting with a Map 6. Working with Custom Views 7. Working with Location Data 8. Know about the Street View 9. Google Maps Intents 10. Creating a Custom Map Application A. Answers to Self-test Questions Index

Exploring Android Studio

Let's see how we can do some basic things with the official Android Studio IDE. You can change the appearance of Android Studio as you wish. It has some inbuilt themes like:

  • The IntelliJ theme, which is the default theme
  • The Dracula theme, which is a dark cool theme

You can change the theme by navigating to File | Settings | Appearance.

Creating a sample application

Let's create our first sample Android application using Android Studio.

  1. To create a new project, select File | New Project. The following window will appear:
    Creating a sample application

    The wizard for creating a new project

  2. Enter the values in Application name:, Company Domain:, and Package name:. Then, select the project location.
  3. In the next screen, you need to select the minimum SDK version that your application supports. Targeting your application for a lower SDK version ensures that your application runs on a maximum number of devices. As of now, KitKat has a market share of 34 percent.
  4. In the next screen, you need to select an activity template. This template helps you to simplify the task. For our sample application, select Blank Activity.
    Creating a sample application

    Selecting an activity template

  5. In the next screen, you should enter the name of your main activity and the name for your main layout. Menu Resource Name is for the action bar menu layout file.
    Creating a sample application

    Defining the name for the activity and layout

  6. Then, click on Finish. Wait for some time until Gradle builds your project information.

    Your sample app template is now created. Let's now explore Android Studio.

    The section on the left-hand side is the project explorer and the section on the right-hand side is the code editor. You will see three folders: manifests, java, and res inside your app. The manifests folder contains our application's AndroidManifest.xml file. The java folder contains our Java classes, which make our Activities, Fragments, and other functions. The res folder contains all our layout files and styles.

  7. Now, run your application on the Android emulator or on your own physical device. To run the application, you can click on the green Run app icon in the toolbar or you can select Run | Run app.

You will see the text Hello World in TextView. Physical devices are a lot faster than the Android emulator, which runs on your PC.

Exporting the Android application as APK

Your Android app should be exported as APK and signed to be able to publish it in the Google Play store and install it on your device. In order to sign an APK, you need to create a key store. Let's see how to export in Android Studio.

  1. Select Build | Generate Signed APK.
  2. The Generate Signed APK Wizard window will appear. You need to create a new key store by selecting the Create new button. Enter the required details. One of the fields in the Certificate section needs to be nonempty. You can leave the rest of the fields empty. The minimum validity should be 25 years.
    Exporting the Android application as APK

    Creating a new key store

  3. Then, select OK. Your new key store will be created. If you have already created a key store, you can use it. It is recommended to sign different apps you create with the same key store. Key store is used to authenticate you. So, keep your key store safe. Note that, if you lose your key store, you can't update your app published in Play store.

    The following screenshot shows the Generate Signed APK Wizard window:

    Exporting the Android application as APK

    Generate Signed APK Wizard

  4. Then, select Next. In the next window, you should select the destination folder of your APK. Then, select the build type, whether it is Release or Debug. While running our app on the virtual device, it will run in the Debug mode. You cannot distribute a Debug build in Play store. The Release build is the final build that can be uploaded to the Play store in which the app must be signed with your own certificate. Finally, select Finish. Your APK will be generated.
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image