Hi,
I'm getting the error:
when running in-app billing from a service using the code:
The line cousing the error is the call to requestpayment. What is wrong? It used to work when I embedded it in the main activity.
I'm getting the error:
B4X:
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for xxxxxxxxxxxxxxxx
Subscriptions AVAILABLE.
Subscriptions supported: true
** Activity (principal) Resume **
Error occurred on line: 89 (DownloadService)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference
at anywheresoftware.b4a.inappbilling3.BillingManager3.RequestPayment(BillingManager3.java:91)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:753)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:343)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
B4X:
Sub Service_Start (StartingIntent As Intent)
manager.Initialize("manager", key)
manager.DebugLogging = True
End Sub
Sub Buy (producto As String, payload As String)
manager.RequestPayment(producto, "inapp", payload)
End Sub
Sub Manager_BillingSupported (Supported As Boolean, Message As String)
Log("Subscriptions supported: " & manager.SubscriptionsSupported)
End Sub