Android Question App Subscription

Cleidson

Member
Hello everyone,

I've been working for the past few days configuring an application so that users can purchase subscriptions for its use. The attached example shows what I've been able to program so far. It works in debug mode. However, in release mode, it returns the error "billing_PurchasesUpdated was not found". I've tried numerous ways to work around this error, but without success.
Therefore, I'm asking for your help.
Thank you in advance for your attention.
 

Attachments

  • Signature Test.zip
    18.2 KB · Views: 14

DonManfred

Expert
Licensed User
Longtime User
Therefore, I'm asking for your help.
You forgot to add the billing_PurchasesUpdated event?

Add

B4X:
Private Sub billing_PurchasesUpdated (Result As BillingResult, Purchases As List)
    
End Sub
 
Last edited:
Upvote 0

Cleidson

Member
Don Manfred,

No. The event is declared in the code. I researched some possible situations regarding the issue. Some suggestions referred to the code obfuscating and the return not finding the function due to the obfuscation.

Other suggestions referred to the activity.

There was one suggestion to inform the compiler not to obfuscate the event.

I tried many measures to solve it, but, as I said: it works very well in debugging, but in Release it gives the error.
 
Upvote 0

zed

Well-Known Member
Licensed User
The problem likely stems from obfuscation.
The event is renamed. As a result, the library can no longer find it, causing an error only in Release.
Uncommenting `#RaisesSynchronousEvents` and making the method public should resolve the issue.
 
Upvote 0

Cleidson

Member
Zed,
This is a situation I don't understand why it didn't resolve. I left `#RaisesSynchronousEvents` commented out on purpose when I put together the example. But I've already used it in tests with it active. The same error occurred.

I studied activity destruction, moved the code to activities that wouldn't be destroyed during the app's active lifecycle. In short, as I said, I've been researching the reason for this error for a few days.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
1 - You didn't include this line in the manifest:
B4X:
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)

2 - I tested your code with this line and a real purchase information and it shows correctly:
acknowledge: (BillingResult) Response Code: OK, Debug Message:
Subscription successfully confirmed on Google.
1768228787523.png


3 - I saw several changes in the original code from Erel. I use the code in all my apps that has subscription and worked well.
 
Upvote 0

Cleidson

Member
Asales,
Regarding the manifest, there is a declaration. I forgot to include it in the example.

As for the code changes, they were refactorings to perform other actions according to the responses. They were not inserted because they were not relevant to the problem. Regarding your test, was it performed in Debug or Release mode?

Up to that opening part, the code works fine. And the moment I slide to subscribe, and there is a return, the error I described occurs. I don't understand.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Regarding your test, was it performed in Debug or Release mode?
Release mode.
Up to that opening part, the code works fine. And the moment I slide to subscribe, and there is a return, the error I described occurs. I don't understand.
I get this return, like show above: Subscription successfully confirmed on Google.

As your code is different from the example, that I use - and your code worked for me - I can't give any other insights, that:
- test with the original example
- check your product configurations in Play Console
- test with another device
 
Upvote 0
Top