Join Albert Lo for an in-depth discussion in this video Demo the starting app, part of Android App Development: In-App Purchasing.
- [Narrator] Let's take a look at the starting point project for our course. I have Android Studio opened already here. I'm going to select import project and under the exercise files folder I'm going to select starting project and I'm going to open the finder window and go into app and go into our package. Now for the purposes of our course we need to rename this package to something unique. The reason is because if we want to go ahead and publish this app we cannot publish an app that can wind up having the same package name as another app in the Play Store.
In other words, one of the Google Play Store requirements is a unique app package name associated with a unique Google account for publishing to the store. So let's go ahead and rename this package as follows. I'm going to open the manifest and in the Android manifest I'm going to put the cursor right before renameThis keyword and I'm going to press Shift + F6. This dialogue is basically asking us to confirm do we really want to rename this package and we are going to select yes to rename package.
Now I'm going to rename this to odyssey designs, but keep in mind that you will want to give your package name something unique and different from the name I'm using here. Let's go ahead and press refactor. And then on the bottom left we'll press do refactor to confirm and now we see that it has renamed our package. And if we go into a file like MainActivity we'll see that it has the new package name.
Now let's go into the test package and open up ExampleInstrumentedTest and scroll to the top. I'm going to move the cursor right before the renameThis keyword and press Shift + F6 and then select rename package. And I'm going to use the same package name that I had before, odyssey designs. I'm going to copy this keyword, odyssey designs, and paste it into here.
Okay, so now we are done with renaming our package. Let's close off some of these files. Let's do a gradle sync and once the gradle sync gets finished let's do a gradle clean and once the gradle clean is finished we press play to do a gradle build and I will select a virtual device that I have previously created. So one more thing that we need to do is open up the app module's build.gradle and we also have to change the package name for the application ID.
So I'm going to delete that and change it to the package name that I'm using. Okay now we're ready to do a gradle sync and once the gradle sync is finished let's do a gradle clean. Once the gradle clean is finished let's press play to do a build of our app. And I'm going to select the virtual device that I've previously created, Pixel XL. Now I'm going to just minimize Android Studio and bring over the emulator into view.
Okay now we have our app running for our starting point. I'm going to open the side nav drawer, select Google Photos and now we have our albums loaded. Once I select an album then I select a Google Photos item and it will show our crop screen. Okay so now we have complete demonstrating our starting point.
- Setting up an existing app for In-app Billing
- Working with the Gradle build system
- Registering a keystore
- Defining and accessing Gradle build configuration parameters from code
- Setting up a payments merchant account
- Setting up IAB test accounts
- Publishing the APK to Google Play alpha
- Defining managed products and subscription products
- Implementing In-app Billing
- Testing in-app purchases
Skill Level Intermediate
Q: This course was updated on 07/20/2018. What changed?
A: The following topics were updated: UI setup for in-app billing, adding public key, publishing your APK to Google Play alpha, and implementing in-app billing.