Test In App Purchases Android Developer Account - android

I have recently set up basic In App Purchases in my Android app that I am building. The problem I am having is that every time I install the app, via USB, I get the error "This version of the application is not configured for billing through Google Play. Check the help centre for more information.".
It seems that the only way I can do a real test, using real SKUs is by uploading to the beta test group and installing from there. This can take up to 2 hours.
I am aware that I can use the SKU "android.test.purchased" instead of my own SKUs which I have created with the Android dev console. This is not ideal as it slows down my development time.
I am sure I am missing something and I was hoping someone could please point me in the right direction.

Thank you Karen.
Worked out my issue was due to not signing my app with the keystore each and every time I build the application and installed via USB.
This option can be found in File -> Project Structure
Then select the module that you are signing, and then the tab "Signing" from the top of the window.
From there you just need to press the plus and fill in your details for the keystore.
After which, you need to go to the "Flavors" and "Build Types" tabs and select the signing config (one you just created).

Related

Android / Google Play in-app purchase "Item unavailable in your country"

I'm trying to test the in-app purchase of a consumable item on Android, but I'm unable to do so, as the item appears as being unavailable in my country:
This only happens when I'm testing on a device connected to Android Studio (which I need to be able to do) - if I instead download the app onto the device, the consumable item appears normally, i.e. as being available.
Some details:
I'm testing on a physical device running Android version 6.0.1
That device is running the latest version of the Google Play application
I'm testing with a user that has been set up both as a track tester and a license tester, and that is also currently signed in on the device
I've made the app available in all available 177 countries and regions
The app does not have a production release, it's only available on the closed testing track
If you have uploaded the build from the closed track, please ensure that you have accepted the test invitation from the invited email or it will show this error.
Step 1: Go to Release -> Testing -> Closed Testing
Step 2: Click on Manage Track
Step 3: Click on Testers tab
Step 4: Scroll to the bottom and you will see 2 options. Copy the link for web and open the link in your phone or browser with the test email you want to test.
Step 5: When you open the link you will have an option to Become A Tester. Click on that and then you are good to go.
The solution in my case was to select the app in the Google Play Console, then go to Release > Production > Countries/regions, and add the countries/regions there. Having the countries/regions selected in the closed/internal track only is not sufficient. It seems this is necessary regardless of whether one actually has a production release or not - again, in my case, I did not. It took maybe 10-20 mins after I made the update until I stopped seeing the issue.
TL;DR:
Upload to the Internal Test track and make sure it has the highest version code
I was having this issue for a few days, and also tried numerous things, but to no avail.. I uploaded my app bundle to a Closed Testing track in the Play Store, which did not solve the problem. After countless other methods, I eventually tried to upload a bundle to the Internal Testing track, which immediately solved the issue and allowed me to use test cards again.

How to publish to google play from visual studio

I have a cross platform Xamarin app that I have already delivered to App Store Connect for internal testing and it works great. It was not an easy process but now that it is setup properly my testers get an email every time I upload a new version for them to test.
I expected a similarly arduous task to get the Android version up on to Google Play for testing and I was not wrong. There is a lot of documentation (for instance https://learn.microsoft.com/en-us/xamarin/android/deploy-test/publishing/publishing-to-google-play/?tabs=windows) but much seems out-of-date and I kept getting stuck and frustrated that this has to be so complicated. However, I finally have achieved some success and I wanted to share my procedure and I have a question at the end.
In VS change from debug to release
Right click on Droid project and select properties - under Android
options/Android package format select bundle
Right click on Droid project and select archive - this will initially
build a bundle that is not signed so it can’t be uploaded to Google
Play but we will use it to create a Signing Identity.
Once the archive is done the Archive Manager will open. Select it
and tap the Distribute button. Select the Google Play channel.
On the Signing Identity page use the + to create a new Android
Keystore. This will not be applied to the current bundle so we must
do the archive again to get it signed.
Back in the Droid project properties select Android Package Signing,
check the checkbox to sign the .APK, although we are actually
creating a bundle and not the .APK. Navigate to the Keystore and
provide the password that you just created. Also, fill in the Alias
using the name of the keystore and provide the password again. I am
not sure why this necessary. Now we can create another archive as
before but it will be signed!
Theoretically one could then use the Distribute button of the Archive
Manager to upload the bundle to Google Play, but that requires you to
have an OAuth client on Google Play. I could not figure this out (it
requires an SHA-1 certificate fingerprint that I could not find) and
fortunately there is another way.
After logging in to Google Play use the All apps / Create App button
to create the app project that will be used for testing and release.
There are a lot of hoops to jump through but they do a pretty good
job of walking you through the whole process. You won’t be able to
initiate testing until all the requirements are fulfilled.
There are two notable steps:
For certain permissions you will need a privacy policy online. I
used this site to create mine:
https://pages.flycricket.io/gammadog/privacy.html
For certain permissions you will need a YouTube video explaining how
your app uses these features. Here is mine:
https://youtu.be/GVbKg1OS7Lk
After setting up your Google Play app project (whew!) you can now select it under
All apps. On the left side there is a Testing section. Select
Internal testing and then Tap the Create new release button.
Back in your VS Archive Manager tap the Open Folder button to reveal
your archive (.aab). You can now drag this to the App bundles upload
rectangle on the Google Play app project/Internal Testing/Releases tab. It will upload the bundle and check its
requirements. If you are like me you will have to go and fix things
in your Google Play project (jump through a few more hoops) before it
will upload without error.
Still in your Google Play app project/Internal Testing select the Testers tab. Here is where you set up your testers. Presumably there is a way to send a bulk email to all testers at once but I don't see how to do that.
However, there is a "Copy link" under "How testers join your test". The confusing thing is that initially the "Copy link" is not active and there is no indication as to why. After some time it finally becomes active and you can send this in an email to your testers.
So here is my question:
I have been using an Android tablet for testing this app and it works perfectly when loaded from VS. However, when I click on the link from my email that takes me to Google Play to install it the install never completes and it just sits there spinning forever. Has anyone else run into this and come up with a solution?

Capture app console.log from an Android alpha/beta release?

Working on a Cordova app:
We are trying to find a way to capture JSON results of an in-app transaction. In debug mode, we have access to the console, but in-app billing is disabled; when we've pushed an alpha or beta release to our GDC, the in-app billing works but we do not have access to the console. We use variations of pop-up alerts but this is a flaky solution. The main annoyance stems from having to build & upload to GDC every time we want to test new things that have to do with in-app billing. Surely there is something we're missing.
Is there a way to read the console (or any output of that sort) from a built Android app?
First of all plug your device to computer, from Android Studio, choose Tools > Android Device Monitor or click the Android Device Monitor icon. This will show your device and apps running on it. You can filter type of logs it is showing (because at moment device shows lot of logs).
But if you use command line then , in the SDK tools/ directory, enter the following command :
monitor
It will also open monitor tool. Here is documentation to this tool.

Android 4.2 developer settings still unavailable

How do you access Android 4.2's developer settings when the method prescribed on their developer site does not work?
I followed the directions on a Nexus 7 tablet. I went to Settings > About tablet, scrolled to the bottom of the screen, and clicked the Build Number 7 times. I was greeted with the message "Congratulations, you're now a developer." But apparently, I'm still not one.
I checked Settings and scrolled all the way down to the bottom, but no Developer options were available. I reset the tablet and restarted it, with no result. When I click on Build Number again, it says "No need, you're already a developer"."
UPDATE:
Something else that might be an issue. There are two tablet user accounts. The account I'm using to access the developer settings is the second one. The first account is probably not set up as a developer.
I have ran into the same problem yesterday. Only the initial user (or Owner) shows the developer options in the settings menu, when turning on developer mode.
Turn on developer mode for your initial user and you should be able to see the developer options.
I wonder why the secondary user cannot be in developer mode.
EDIT:
I am now using the secondary user in developer mode and running my project from Eclipse works just fine!
Ok, I was having the very same issue, and yet, I had previously used this exact same device for development.
In my case, the issue was that each User account gets its own "install" of your release (or debug) APK.
Android will apparently "reference" the app and actually keep the package on the system until you do a separate uninstall for each account.
After doing this, I was able to debug without issue on the alternate account.
So, YES, you CAN debug your app using a second account on Android, just be aware that instances of the app installed in various accounts (release vs debug) cannot co-exist!
I installed Lollipop and created a second user.
Eventually i too ran into the same issue but there is a very simple workaround/flaw.
Go to the primary account, from android studio, Run the app like you always do.
Go to the second account and the app was present over there. Go ahead and launch or debug and continue working :)

In-app Billing - Item requested not available for purchase

I am working on learning in-app billing but I am having a problem with the google's in-app billing example, the Dungeon one.
I have already set up the application, added my public key, and changed the API_VERSION to 1 in the makeRequestBundle().
I have already exported and signed the application and uploaded it onto Google Play and saved it as a draft with a few pictures and activated the apk. I also added both the sword_001 and potion_001 as published in-app purchases!
Next I installed the signed app onto my phone but when I try to purchase either the sword or the potion I get an Item unavailable error
The item you requested is not available for purchase.
I even tried on a different device to make sure it wasn't because developer's can't purchase their own products, and I get the same message on both devices.
What have I missed?
Check your versionCode. It can't be higher than the last published/unpublished version in any of your distribution channels (prod/beta/alpha).
In app billing seems fraught with pitfalls, but this is what I found that affected availability of items for purchase and also suitability of application:
My code for what it was worth was strongly based on the Google Android demo, but I stripped out a lot of the complexity. I have a feeling that having got it to work a better result would be produced by writing it all again from scratch.
I got the static test product ids going first.
Despite what the documentation says, it seemed to me that the purchase item(s) must be published, even when using a test account. Mine didn't work when they weren't, anyway, and I waited quite a long time to see if they would start to work as others have suggested - they still didn't.
You (I anyway) can't publish a purchase item without publishing the app, so what I did was upload and publish the app, create the purchase items, publish them (big button at the bottom of the page), then unpublish the app again. This seems to leave the items published.
The app must be signed in the usual way (I did this by exporting from Eclipse) before uploading, but what isn't so obvious is that the app you load to the mobile MUST also be signed in the same way - ie a (debug signed) version loaded to the device by Eclipse - run or debug - isn't going to work.
They also both need the same version number, I think. Not 100% sure. If so that would unfortunately kind of imply that customers with old versions installed can't purchase anything without upgrading.
When the app is uploaded to Google, it can take several hours before it becomes available and you get all the right responses for the in-app billing. I find 1-2 hours typically.
I suspect the other comments on this subject about whether you use a gmail or googlemail test account might be red herrings, but for what it is worth, my test account is gmail.
I did come across a useful little note on the internet somewhere about how to change your primary account on the mobile without having to do a hard reset (and consequently losing everything), but unfortunately I haven't managed to find it again.
What I did find though is that one can have several google accounts on the mobile, and then select the one to be used by Google Play.
Hope this helps somebody. I have to say its a pretty complicated system, with not many switten down answers, and I nearly gave up on it.
If your app are on closed alpha testing, you have to sign in with your test account to Opt-in URL; https://play.google.com/apps/testing/{your.app.namespace}
My experience on this error is:
Make sure to upload the signed APK to developer console.
Make sure to install the signed APK on your device not launch the app in the debugger.
Make sure to create a test account in your developer console.
Make sure to sign in your device with your test account.
Make sure to create in app billing in your developer console and finally activate the item from the console!!! (this is the one that got me after fully following google's tutorial)
It's no longer sufficient to just upload an unpublished draft apk to test in-app billing. What you need to do is upload an apk to the alpha or beta apk section on the Developer Console. Then, you need to publish it. If you also have a draft apk in the Production APK section, be sure to delete it before you publish. Otherwise it will be available to everyone.
Publishing an alpha or beta apk makes that apk available to only those testers that you specify/allow.
Here is Google's documentation on this:
https://support.google.com/googleplay/android-developer/answer/6062777?rd=1
Well I found a solution to my problem. I wasn't able to get Google's in app purchasing example to work but I was able to get this InApp Billing Tutorial to work using the steps I mentioned in my original post.
If nothing else this may be helpful to someone to see all of the steps that need to be done to test one of the in-app billing examples.
Also had this problem for a couple of days and searched around a lot. I found this guy who said deleting the app and then reuploading fixed his problem, and that actually worked for me aswell.
Try that, delete your app from the developer console entirely. And reuppload a new signed apk and set it up all over again
Publishing the app did the trick for me(and leaving it published (!)). I had to wait a bit for Google to update their database as well, as mentioned elsewhere, changes on Google Play are not immediate.
Anecdotal Supplement: If you have an existing app in the portal already and you want to test a signed version, but not upload it into the portal for distribution. Do the normal steps to build a signed version BUT use your latest version code that is uploaded into the portal. You will will be able to do a quick and dirty test of purchasing (you can't upload this version on the Google Play portal, but it's a means to an end for a localized test (or even as a way to allow side loaded distributed versions/flavors that use Google Play for billing legitimately.)
3:)
Check if your device have more than one account then remove other accounts and keep the account you have entered in play console then it will be solved.

Categories

Resources