Adding subscriptions to your Android app. Part 2. Busy work
Tags: mobile, android, kotlin, tristan
Published: 2023-03-10 23:24:42

### Table of contents
1. [GitHub code](#github)
2. [Before we start](#start)
3. [The Busy Work](#work)
4. [The parts I struggled with](#struggle)

### My app on the Google Playstore
- [HERE](https://play.google.com/store/apps/details?id=com.elliottsoftware.calftracker)

### GitHub code <a name="github"></a>
- [HERE](https://github.com/thePlebDev/CalfTracker)


### Before we start <a name="start"></a>
- Before you can read any further, you must have done the following 2 things

**1) Implement the Google billing library :** The library can be found [HERE](https://developer.android.com/google/play/billing/getting-ready#dependency). You need to add this library to your gradle.build file.

**2) Release you app to the play store :** Once you have released you app to the google play store with the google billing library, you can now start creating subscriptions

### The Busy Work <a name="work"></a>
- This section will involve you reading a lot of documentation and setting up a lot of internal google features. The specific documentation which is needed can be found [HERE](https://developer.android.com/google/play/billing/getting-ready#products)

- Besides there being a lot of reading. The documenation,[HERE](https://developer.android.com/google/play/billing/getting-ready#products), is actually very straightforward and relatively easy to follow. If you ever feel lost or confused, don't worry, I felt that too. There might of even been a few times where I stated,` you $*****5* that makes no $@*---- sense, why the @#$$** would you do that?`. Just make sure to take a break, keep reading and don't be afraid to start over.

### The parts I struggled with <a name="struggle"></a>
- The first part I struggled with was the [Setup Cloud Pub/Sub](https://developer.android.com/google/play/billing/getting-ready#setup-pubsub). I found there to be too many guides and external links with no straight forward path. At times I even felt the documentation was repeating itself. To overcome this I used the recommended [Quickstart guide](https://cloud.google.com/pubsub/docs/publish-receive-messages-console) and then I just ignored the `clean up` section of the guide.

- The second part I struggled with was the [Enable Real-time developer notifications for your app](https://developer.android.com/google/play/billing/getting-ready#enable-rtdn). No matter what I did I could not get the `Test Message` to send to the cloud `pub/sub` I had set up earlier. The answer was, to give the proper service account Pub/Sub Publisher access to the topic. The proper service account is `google-play-developer-notifications@system.gserviceaccount.com`.

- I know this guide was short and is not the walk through you were probably looking for. But I do believe the documentation,[HERE](https://developer.android.com/google/play/billing/getting-ready#products), really does do a great job at explaining how to get everything working.

- The next part in the series is where we will be integrating the code into our app.


###Conclusion
- Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on [Twitter](https://twitter.com/AndroidTristan).