i am using your code in side my fragment. But even after my product is succesfully subscribed onproductPurchased is never called. Please help me in this.
Bump
You need to provide more detail. Are you seeing errors in onBillingError()? What does your code look like? How do you know your product is successfully subscribed? Honestly, there is zero actionable information in this issue.
Please consider posting your question on Stack Overflow.
It looks like your default config in your tutorial & sample. No, onBillingError is not called. I know the product was successfully subscribed because when I launch the IAP screen once more, this time a premium upgrade success message is shown instead of the purchase dialog.
———
This transmission (including any attachments) may contain confidential
information, privileged material (including material protected by the
solicitor-client or other applicable privileges), or constitute non-public
information. Any use of this information by anyone other than the intended
recipient is prohibited. If you have received this transmission in error,
please immediately reply to the sender and delete this information from
your system. Use, dissemination, distribution, or reproduction of this
transmission by unintended recipients is not authorized and may be
unlawful.
On Jan 9, 2018, at 01:19, Tony Robalik notifications@github.com wrote:
You need to provide more detail. Are you seeing errors in onBillingError()? What does your code look like? How do you know your product is successfully subscribed? Honestly, there is zero actionable information in this issue.
Please consider posting your question on Stack Overflow.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
I solved my problem by initializing and implementing all billing methods in my activity.. Now everything is working fine.
@tjmille2 without seeing some code, it is impossible to be of any assistance.
Got the same problem using the code inside a Fragment, the onActivityResult is also never called inside the fragment, but it is called with the onActivityResult of the activity
If you are having issues with onProductPurchased() not being called within a fragment, see this Stackoverflow post which describes how to call the onActivityResult of your fragment.
The gist of the post is, within your activity, override onActivityResult and have that call your fragment's onActivityResult method:
protected void onActivityResult(int requestCode, int resultCode,Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = fragmentManager.findFragmentByTag("YourTag");
if (fragment != null)
{
((MyFragmentThatCalledPurchase)fragment).onActivityResult(requestCode, resultCode, data);
}
}
I was able to use this method and my file setup looks like this:
Activity1 opens Fragment1Fragment1 opens a ModalDialogFragment1ModalDialogFragment1 calls billingProcessor.subscribe(activity, productId, payload)onActivityResult in Activity1 is called and I use the method above to retrieve the ModalDialogFragment1 by tag and then onActivityResult is called within that ModalDialogFragment1 and all is well 🙏
Most helpful comment
If you are having issues with
onProductPurchased()not being called within a fragment, see this Stackoverflow post which describes how to call theonActivityResultof your fragment.The gist of the post is, within your activity, override
onActivityResultand have that call your fragment'sonActivityResultmethod:I was able to use this method and my file setup looks like this:
Activity1opensFragment1Fragment1opens aModalDialogFragment1ModalDialogFragment1callsbillingProcessor.subscribe(activity, productId, payload)onActivityResultinActivity1is called and I use the method above to retrieve theModalDialogFragment1by tag and thenonActivityResultis called within thatModalDialogFragment1and all is well 🙏