Trying to test Google In-app-billing, but has strange behaviour - android

I have a developer account and have published my app on Google Play. After that I started working on Ads and In-app-purchases. For the in-app-purchases I am using this repo: https://github.com/anjlab/android-inapp-billing-v3
I tested it first by using Androids test product id (android.test.purchased), and it worked as expected. Using that test Id, I could buy the product and could also check if the product was bought.
Then I created a merchant account using the developer console, and also added a product to it. I found the merchant ID and the product ID to be used in the app.
Instead of using the android test product id, used mine as the LICENCE_KEY and added the MERCHANT_ID (which i did not use with the test product id). Here is the BillingProcessor constructor:
bp = new BillingProcessor(MainActivity.this, LICENCE_KEY, MERCHANT_ID, MainActivity.this);
Lastly I rolled out this new apk version to alpha, and added a gmail address for another account I have in the closed alpha testers list.
Now here comes the strange part: As the new account i opted in on the alpha on my computer. In the Google Play app on the phone I switched users to the new account and downloaded my app. I checked that this was the right version and it was. I also checked that the app was in the library inside "my apps and games" for the right user. I then tried the in-app-purchase, but I get a window with a text saying "please sign in to your google account, authentication required". I have seen similar error messages on SO, but they had forgot to add emails in testers list etc. and I know thats not the case for me.
I even tried creating a brand new gmail account, added it in the testers list and then used a new phone with the brand new account just to be met by the same error message.
At this moment I have no clue what is going on, so I ask in the support chat inside the dev console. They did not know why it did not work, so I had to wait for the answer through email. days later they sent me an email and said that I should try clearing the cache and cookies for chrome on my phone. I did and still no fix.
So if anyone has experienced the same, or know any nice solutions for this it would be awesome

Rolled out app as closed beta instead of closed alpha and it works fine now. I have no Idea why :P

Related

Google OAuth sign-in stuck loading consent screen

My app uses the Google Drive API to back up user files. I wanted to test my app sign-in from scratch so I manually revoked the app from my Google account settings but when I go to sign in again, I'm stuck loading the consent screen (see below) after choosing my Google account.
This is what I have...
Publishing status is "Testing", user type is "External", and I've added/using the right test users
Registered both my debug and production keys under OAuth 2.0 Client IDs
Scopes are only "./auth/drive.appdata" and "./auth/drive.file"
Domain is verified, provided organization website, support email, privacy policy link, and custom app icon
This is what I've tried...
Reinstalling the app and clearing data
Waiting about 24 hours
Removing the Google account from the device and signing in again
Deleting and reuploading my debug SHA-1 key
Disabling and reenabling the entire Google Drive API
Using a different Google account that has never been used with my app before (makes me think it's something on Google's end)
Using different test devices (emulator + physical devices)
Checking out old code branch from known-good time (in other words, sign-in code is the same)
I emphasize again that this sign-in and OAuth flow was working before (albeit showing the consent screen for "unverified" apps since it's still under development). I have not changed any scopes nor reconfigured the OAuth consent screen.
Does anyone have advice on other things to try here? Given that this was working before, I'm not sure what else I can change from my Google APIs dashboard.
I understand that my question is very similar to one asked before, however in that case apparently using a different account ended up working – that is not the case for me.
Mine was the same case. It used to work fine, but then after some months Google sign in Screen asked verification, and then after some days this loading stuck issue appeared.
But the issue was of Goole Drive Scopes if you don't want to go for verification and your use case is simple then use recommended scopes as mentioned here https://developers.google.com/drive/api/v2/about-auth
I just wanted listing, getting and creating of files, the below scopes did the work for me
GoogleSignin.configure({
scopes: [
'https://www.googleapis.com/auth/drive.appdata',
'https://www.googleapis.com/auth/drive.file',
],
...
...
});
taken the create file scope from here https://developers.google.com/drive/api/v3/reference/files/create
I had the opposite problem of most of you: my consent screen worked fine in testing mode but got the infinite loading bar in production. It turned out I was using the wrong Google Photos scope in my app code. I was only requesting https://www.googleapis.com/auth/photoslibrary.readonly in Google Cloud Console, but in my app I was using https://www.googleapis.com/auth/photoslibrary. I'm still not sure why I was allowed to use a broader scope in testing but not in production.
Had a similar situation when my app was rejected for using 'YouTube' in the description after being on the Play Store for 4 years...[but anyway]
After dinking with it for a long time and creating new credentials all kinds of stuff
I went to:
google account
revoked access for the app in question
in the dev console: move the app back to testing [make sure you have testing users on your list]
uninstall the App
install the app
after I picked the account, I got the same blank consent screen with a twirling progress dialog, but I also got an email; once I confirmed it was me through the email the progress bar went away and I got the oauth dialog as expected, when I clicked allow, everything worked. Back when I originally built the App before it was rejected, I don't remember the email confirmation being required, but I could be wrong. I swear I had tried this a dozen times. I wonder if Google does something on its end...
I eventually got it working after I changed my consent screen to production mode instead of testing. The issue on Google's end (see comments) seems to have been closed with "Won't fix (inactionable)".
Update: There appears to be different causes for being stuck at the OAuth screen. In my particular case, it turned out to be a Google-side issue that I believe they later may have fixed. Other answers here may be equally helpful but I've accepted my own answer because that was specifically the conclusion to my own problem.

Google sign in issue: "failed message=12500"

I m trying to migrate google sign in from one account to another in my android app. I have add the package name and sha1 key into new account and then also added the"google-services.json" file. But every time i m running it, it shows me "failed message=12500".
I have tried everything, looked at all the solutions everywhere.
When i use the old account and old "google-services.json" file it works but as soon i tried to migrate to new account it doesn't work. The crazy thing about this is that i m using other services as well like firebase notification, phone authentication and remote config they all work perfectly fine in the new account, but not google sign.
This did the trick:
Add application logo, Application Homepage link and Application Privacy Policy link. To add both link you can just copy and paste from Authorized domains section from "oAuth consent screen", for example: your-app-abc123.firebaseapp.com
This is a must step for migrating or adding a new app, because i spent hours and hours and with no results and only this thing helped me out.

Android alpha testing "Item not found"

I have published my app for alpha testing, but not able to download it from play store.
I have opened the url "https://play.google.com/apps/testing/com.*" and accepted to be a tester and now it shows me "you are a tester". But when I click on the link "download it from the Play Store", it shows me "Item not found" in my test device play store and "requested URL was not found" in desktop browser.
App is in published state for more than 48 hours.
App is published in all countries.
google groups for testers are added, I can see the group in manage testers tab. Tester account is added to the group ( triple checked it)
test device has only one tester account.
I can access the in-app purchases, which means the app is published properly. Google doesn't support draft mode anymore.
I went through some similar posts in stackoverflow, but there is no definite answer. Looks like for some people it resolved automatically and some people are not lucky enough.
If the app is "Published", but when you click in "View in play store" the site (example: https://play.google.com/store/apps/details?id=com.companyname.appname) show the error:
"We're sorry, the requested URL was not found on this server",
try this:
In "Google Play Console" (https://play.google.com/apps/publish), select your app
goto menu: Release management / App releases
In Aplha, click in the button "Manage Alpha"
Click in "Manage testers" and copy the link "Opt-in URL" (example: https://play.google.com/apps/testing/com.companyname.appname)
Send this link to your alpha users, you and the users need to click in "Became a tester" before access the app in PlayStore.
After this, open the link of app in play store again (View in play store) logged with a user from the testers list.
If the url still don't open, try close your browser, or clear the browser cache and try again. The browser store a cache of redirects.
If you are using Chrome, then it caches redirects. To fix it, clear browsing data. More details on this
In my case, the issue was that I wasn't logged to Google with the proper account in Chrome.
I cleared all browsing data, but un-logging from Gmail/Google and re-logging with the proper #gmail.com account would probably have done the trick.
Another thing to check is whether or not Pricing & Distribution -> Only make this application available to my organization is checked. It seems that this doesn't interact well with Alpha- or Beta-only tests, even if your test account is in the given domain. Once I turned this flag off, my beta-only app became visible via the Play Store link from the testing signup page.
In addition to all the great answers here, I just found out that if you did an internal test before the closed (alpha) test, the Play Store may want you to use the internal test URL instead.
So say you have your great app and you released it to the internal test track. You created a list called "Internal Testers" for that track and it all went swimmingly. When you did this, Google Play gives you a URL for those testers of the form https://play.google.com/apps/internaltest/{id}. Your internal testers joined the program using that URL, downloaded the app no problem and the test went through.
You now upgrade to the closed track (alpha testing). You create a new list called "Alpha Testers" with new people in it and you enable your release both for "Internal Testers" and "Alpha Testers" thinking that you should carry over your internal testers to alpha. When you do this, Google Play gives you a URL of the form https://play.google.com/apps/testing/{package}. Your alpha testers can now join the program using that URL and download the app. But your internal testers have to keep using the internal test URL to join the program.
From testing a variety of scenarios, it looks like moving a tester from on list to another doesn't fix the problem.
As far as I can tell the Google Play documentation doesn't mention any of this.
Where you add groups for test - there have a link for tester (something like terms) you need to click this link on each testing device and say "Yes"
After that link apear in market. I wait 3 days before found it : )
For my part it was due to the fact that I sent the link through SMS. It worked when I sent it by email. This link has the form https://play.google.com/apps/testing/com.*. This is this link that you have to share by email.
This can be due to a silly mistake where you aren't signed in with the appropriate Google Play account in your device's Google Play Store.
Sign in with the testing gmail account into Google Play and then click on the test-link
For more detail check Item not found
allow access to
Settings -> internal access -> Manage users with download rights later
Settings -> Internal Access -> Testers
and the app link will work
I had this similar issue.In my case, I had multiple testers as CSV and there was an space between multiple users tester.Space was the issue in email address.Bad email address may cause this problem.
Also, make sure the device you are using is among the supported devices for your app. For this, check Release management -> Device catalog on play console.
If this is the problem, expect to see a warning similar to the app is not compatible with your device when you visit play store page via a web browser and Item not found error via play store app.
In my case, I had to make some changes in the Manifest to correct the list of supported devices. So, I replaced below line causing the number of supported devices to be 0:
<uses-feature android:name="android.hardware.camera2.full" />
with:
<uses-feature android:name="android.hardware.camera2.full" android:required="false" />
In your case, Manifest may need a different change of course.
In case someone has tried the several suggestions and has not worked, I want to share another situation I haven't seen listed anywhere else.
Make sure the latest build uploaded is not deactivated. The Play Store console doesn't warn you if, for any reason, the release is made unavailable to your testers. It'll show with a greyed out row, like this:
Check on App releases > Manage, in you track dashboard, that the latest build is Added, not Deactivated.
In my case is Android Studio emulator, I relaunch play store after few minutes googling, then no more such error "Item not found".
In my case the emulator had been started a couple of months ago and perhaps cached something wrong.
I kept receiving BillingClient.BillingResponse.ERROR resulting in this message.
After restarting the emulator it started working again.
Simple way is to use incognito mode. Thats it.

Google Play Services Android won't sign in Adobe Air

Recently I've been trying to get my Adobe Air AS3 Android game to work with Google Play Game Services.
I'm using the Milkman Native Extension and Flashdevelop.
I made my own sign in button, and when I press it the standard "Sign in with your account" window with all my accounts appears. The first time I sign in with an account it even gives me the standard options to share my game status to my Google+ circles. Then, when I do try to log in, the service shows the standard spinning progress wheel, then disappears, the "Signed in as PLAYER" box doesn't show up, and I'm not logged in. The ANE tells me that it's an unknown_error_code.
Things I've noticed:
It doesn't let me see a list of achievements or leaderboards either.
After the first time I log in it just tries
to log me in again indefinitely.
The "Apps using google+ data" shows it as a "3rd party app" and not the actual title of the app. EDIT: It now displays it as the correct app for some reason. Still doesn't sign me in though...
I'm pretty sure this isn't a coding problem.
Things I've tried:
Matching the SHA1 key with the SHA1 key from my p12 key.
Logging into different accounts.
Making my accounts tester accounts.
Using non tester accounts.
Making new Game Service pages
Making new application pages
Changing my app I.D. (com.blank.mygame)
Clearing the "Apps using google+ data"
Making the Version Number of the game higher than the most recent test account
Making new Google+ accounts
Syncing my app to the services page.
Desyncing my app from the services page.
Making new OAuth 2.0 client I.D.s.
Publishing the game services.
Any suggestions?
Now I can answer my question officially:
I fixed it.
Apparently if you go to the API console and change the Oauth from there the game services doesn't detect it. I originally put in the wrong SHA1 and fixed it through the API and not the google services developer console.
http://www.youtube.com/watch?v=nkJS_W-VC9I (it's problem #6 which is really n)
I was having the same problem, and I solved it by changing the App/Package ID at the Google Developer Console from:
com.developer.appname
to:
air.com.developer.appname
I had simliar issue - the app was asking for permition, but it triggered onSignInFailed event.
Tried several things, the problem was with runtime enviroment - everything works correctly when I include it to application. (I was using separate AIR runtime enviroment to decrease the time of publishing the app)

Debug Android inapp billing using Eclipse

Now I managed to sign the apk (using Eclipse Android Tools) and adb install .. to the device for testing.
But this removed the debug function, e.g. "step over" which make problem tracing much more difficult.
Is it possible to debug the inapp billing using Eclipse?
Unfortunately I don't think there is any way to step debug, I have just been using print outputs. This is due to the fact that you have to sign your app with a release key in order for it to communicate properly with the billing service. Very annoying.
When you go through the in app billing documentation, you kinda realize that it can take substantial amount of time to understand this complex piece of technology. Most developers feel the need for a working HelloWorld, and then later play around with the builds.
I have uploaded 2 projects
The android sample project. You can download this project, and immediately run the sample. This will help you quickly debug/trace thru and figure out how the in app billing works.
A cleaned up project to help you integrate your app quickly. This can help like a library. Just integrate make your “purchase requests” on your “checkout” button action.
Mind you : I have not incorporated the security recommendations. Read android in app billing documentation. Until then you are on your own risk.
For 1
Download “http://www.4shared.com/file/f5wH3qke/InAppBilling1.html”
Create a new gmail account for all correspondence (Why, I will explain below)
Pay that 25$ and purchase a “Market Place” account.
Import the project to your eclipse environment
Create a signed application apk, File-Export-Select Your Project-Create OR Use keystore, it should be valid for 25 years from today.
Upload the signed apk to the market place as a “Draft Application”, DO NOT PUBLISH it.
For the uploaded apk, you need to add “In App Products”. You will find this link on the home page for your uploaded apk.
In Security.java dont forget to add your “public key” from your market place account “edit profile” page.
On the “In App Product List”, you need to add the following products one by one
The text below should used as “In app Product id”
sword_001 as Managed
potions_001 as Unmanaged
Title and Description dont matter (for testing purpose). Add what you need here.
Cost add 1$ (minimum)
Click auto fill
Save
Publish the in app project (dont get confused here, you only need to publish the in app product, NOT the APP)
In the test account, add your personal gmail id here. Now, this gmail account needs to be configured as your first gmail account on your phone.
Yes, this WONT work on your emulator
Now the sample app should work.
For 2
Download “http://www.4shared.com/file/h8YnJyf_/InAppBillingIntegration.html”
To integrate, in your calling activity initialize the checkout code
Handler handler = new Handler() ;
CheckoutPurchaseObserver checkout = new CheckoutPurchaseObserver(this, handler);
To send the checkout request for your product
checkout.sendCheckoutRequest(purchaseUri.toString(),null);
Important Note :
This purchaseUri is the “In-app Product ID” of your resource on the “market.android.com/publish-->Create New In-App Product” options. This string should be set as the “in app product” id.
That’s why the “id” is most important. The “In-App Product ID” is how you refer to that particular product.
Also, in Security.java dont forget to add your “public key” from your market place account “edit profile” page.**
Debugging Notes
LogCat will show all errors as InAppBilling tag
This project creates a shared_preferences named “inappbilling” And debug is set to true
The androidmanifest.xml may not be needed since this project does not
have a home screen.
Why do we need to create a new gmail account ?
Simple. The account you purchase your market place account for, cant be used for “testing” your in app billing. Since you cannot purchase products for yourself. And your primary account on your device should be set as a “test account” on the market place account. Chicken-Egg issue here. Hope its clear.
An interesting blog I came by “http://crazyviraj.blogspot.com/2011/06/some-notes-on-implementing-in-app.html“ (not mine).
In my app, I used the test product id, android.test.purchased, which will simulate the actual buying process (ie, will show the in app dialog and you'll be able to purchase and get a response that can be handled by your application). Using that product id, you can run the in app code on the device (unsigned) via eclipse over usb connection. You still might need to work around some things for testing (ie, account for the fact that you are using a testing product id and not your real id), but I found using that product ID did help me quite a bit.
See the testing section of the in app billing guide

Categories

Resources