android in-app testing error - android

I am developing android In-App with 10 In-App product.I complete integrate Android Billing library, the Google test account and setting the Product id, but when I am click on Accept & Buy button the following error occurs
your order could not be processed please try again.
What is the reason for this error. What I am doing wrong?
public void onClick(View v){
if(BillingController.isPurchased(context, MainActivity.ITEM_ID[position])) {
String msg=(String) holder.txtViewname.getText();
Intent intent= new Intent(context,RecipeMenu.class);
intent.putExtra("name", msg);
intent.putExtra("id", position);
context.startActivity(intent); }
else{
BillingController.requestPurchase(context, MainActivity.ITEM_ID[position], true /* confirm */);
}
}
});

Android provide us one example for this same In-app billing example. Please refer Android In-app. And name of that is market_billing. You can find it at android-sdk/extras/google/market_billing.

Related

Getting "Content not found" error when following app-scoped user ID

Thanks again to Cbroe who answered my original question. I implemented his suggestion and although the URL returned by GraphRequest.newMeRequest looks valid, when I followed it, I got a "Content not found" error:
reachOut.setOnClickListener(new View.OnClickListener(){
public void onClick(View view) {
// Navigate to person's Facebook page to send a message.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkArray[selectedPosition]));
startActivity(intent);
}
});
BTW, in the above, I did confirm that linkArray[selectedPosition] contained the correct value.
I had previously (back in 2018!) successfully completed an app review for user_link, so I doubt that that's the problem.
Looks like I had to resubmit my app for approval because now it's working again.

In-app purchase Error while retrieving information from server [DF-AA-20]

i'm trying to enable in app billing. I've created In-app-products on my google play console and got my License key. When i try to purchase product. I get this image error.
Here is the code i use to create BillingProcessor.
bp = new BillingProcessor(this, LICENSE_KEY, MERCHANT_ID, new BillingProcessor.IBillingHandler() {
#Override
public void onProductPurchased(#NonNull String productId, #Nullable TransactionDetails details) {
showToast("onProductPurchased: " + productId);
updateTextViews();
}
#Override
public void onBillingError(int errorCode, #Nullable Throwable error) {
showToast("onBillingError: " + Integer.toString(errorCode));
}
#Override
public void onBillingInitialized() {
showToast("onBillingInitialized");
readyToPurchase = true;
updateTextViews();
}
#Override
public void onPurchaseHistoryRestored() {
showToast("onPurchaseHistoryRestored");
for(String sku : bp.listOwnedProducts())
Log.d(LOG_TAG, "Owned Managed Product: " + sku);
for(String sku : bp.listOwnedSubscriptions())
Log.d(LOG_TAG, "Owned Subscription: " + sku);
updateTextViews();
}
});
LICENSE_KEY is my license key from google play console, and MERCHANT_ID is null.
This is how i buy items.
bp.purchase(this,PRODUCT_ID);
Where PRODUCT_ID is product1 which i use in my google play console, here is the example of my in-app products.
Any idea how to fix this ? There is only one stackoverflow question with DF-AA-20 problem which has no answers. And there is no information on the internet about it. I have tried to use emulator and my android phone.
DF-AA-20 means your app is not published in any way on the Play store. This is normally because either:
you haven't published it yet. To test In-App Billing it must be pushed to at least alpha. See the testing IAB docs
for more information
your app or developer account has been banned/suspended for abuse
you make some change to your package name/applicationId, so that in your apk it doesn't match the one on Play. Developers sometimes do this with build flavors
Oh, I had this exception when I tested buys in my product with different sku.
Check your sku!
Sku must be not CAPS! Only [a-z][0-9]!
Just wait some time. I waited 25 minute and then product registered in google play
It might be handy to point out that you can also get this exact error code message when you simply haven't put your products as active yet in your Google Play Console. (Even in debug they need to be active.)
You must publish your app to playstore(not even alpha or beta publish will help).

Firebase Dynamic links always returned CANCELED

I'm using dynamic links for my app.
I've followed the tutorial step-by-step and I'm able to open the app by clicking on the link posted on facebook.
But when I invoke getInvitation, I always have CANCELED as status of AppInviteInvitationResult.
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false).setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
#Override
public void onResult(#NonNull AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
// Extract deep link from Intent
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
// [END_EXCLUDE]
} else {
Log.d("StartActivity", "getInvitation: no deep link found.");
}
}
});
Into debug, I can see that result.getStatus() returns CANCELED, but the click on lick open the app correctly.
Where I'm wrong?
EDIT: The link that I'm using is:
https://wft4z.app.goo.gl/?link=https://aqld.it/testlink/112972&al=aqld://test/about?params%3D17363&apn=com.project.mydeeplink
The filter on manifest:
The status is canceled when no intent has been received. I was wondering the same thing and it turned out that my links created in firebase web page were wrong. I wrote some ideas on how to debug the url problem as an answer to another question. If you have the same problem as I did, they should be helpful:
https://stackoverflow.com/a/37615175/4025606
Doesn't directly answer your question but you could eliminate badly formed urls as a root cause by using this page to create firebase dynamic links for both ios and Android: http://fdl-links.appspot.com/
Just double-check if you have added the SHA-1 in the firebase console and the added SHA-1 matches the SHA1 of the generated APK. I was seeing the same issue - result.getStatus() returning CANCELED prior to this, but after adding the SHA-1 on firebase console, it started working fine. :)

how to open playstore app with update page programmatically from my app

I am comparing version of my app on google play store and version of app in play store. So whenever new version of app get uploaded it shows dialog to user to update the app, but when i click on "Update Button" in dialog, it opens play store with "Open" and "Uninstall" button instead of "Update" and "Uninstall" button.
So please tell me how to open play store app with "Update" and "Uninstall" button when new version is uploaded on play store.
here's my code to open play store.
AlertDialog.Builder dialogUpdate= new AlertDialog.Builder(Main_list_Activity.this,AlertDialog.THEME_TRADITIONAL).setTitle("New Version Available")
.setIcon(getResources()
.getDrawable(android.R.drawable.stat_sys_download))
.setMessage("New version of app is available. Update your app")
.setCancelable(false)
.setNeutralButton("UPDATE", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
try {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id="+getPackageName())));
} catch (ActivityNotFoundException e) {
// TODO: handle exception
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName())));
}
}
});
AlertDialog updatedialog = dialogUpdate.create();
updatedialog.show();
Google does not provide any api to get the lattest version of application code.
Google does not provide any API for that.
Nevertheless , you can make an http request on the web version of the playstore (https://play.google.com/store/apps/details?id=your.namespace)
To make the request you can use DefaultHttpClient
Once you get the page content you should parse it (jsoup is a good solution) and search for :
<div class="content" itemprop="softwareVersion"> 2.2.0 </div>
Once you find this part of the page , you can extract the version number and compare it with the one available in your app :
try
{
String version = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
if( ! version.equals(versionFromHTML))
{
Toast.makeText(this, "New version available on play store", Toast.LENGTH_SHORT);
}
}
catch (NameNotFoundException e)
{
//No version do something
}
For the HTML parsing part , have a look here
Keep in mind that everybody won't see the new version in the same time. It could take time to be propagated (probably because of cache).
Visit this link https://developer.android.com/guide/playcore/in-app-updates which might help you for what you are looking for. If its matches with your need / requirement kindly up vote this thread.

Google authentication ERROR while trying to purchase with soomla iap

need a little help. Im making an android app and integrated Soomla for a simple "No ads" purchase inside my app. Ive a purchase button which should do the actual purchase via google.
What occurs is a popup from google : "Error
authentication needed, You have to login in your google account" .
I think its a small problem, but i dont get what. I am logged in in my google account. Store in Soomla is running ( at least it says so). ive enable test purchase.Im using my phone for the purchase ofc. What i am missing?
public class NoADsButton : MonoBehaviour {
private static bool storeInitialized = false; // prevent store to be initialized twice
void Start () {
if(storeInitialized) return;
SoomlaHighway.Initialize();
StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
SoomlaStore.Initialize(new SoomlaAssets());
}
public void onSoomlaStoreInitialized() {
storeInitialized = true;
}
public void OnMouseDown(){
StoreInventory.BuyItem("no_ads");
}
And the item ive done as its shown in the soomla example:
public const string NO_ADDS_PRODUCT_ID = "no_ads";
public static VirtualGood NO_ADS_LTVG = new LifetimeVG(
"No Ads", // name
"No More Ads!", // description
"no_ads", // item id
new PurchaseWithMarket(NO_ADDS_PRODUCT_ID, 0.99)); // the way this virtual good is purchased
}
This usually happens when the process of publishing the app for testing wasn't done properly. Try going carefully over Google's instructions, make sure you didn't miss anything. http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test

Categories

Resources