InAppBilling library - Android Market In-App Billing service

KashMalaga

Member
Licensed User
Longtime User
after some days testing. Libs works fine so far.

Just see that still using obfuscate option, service addon can be easily reversed and you just have to change whats happen on:

B4X:
 If PurchaseState = Manager.PURCHASE_STATE_PURCHASED Then
      CallSub2(Main, "sdfsdfgdsfg", ExtraData)
   Else If PurchaseState = Manager.PURCHASE_STATE_CANCELED Then
      ToastMessageShow("canceled",False)
Else
ToastMessageShow("Not registered",False)
End If
So for example in this fast example created. If you change in smail CallSub2 instruction to the Else Line : ToastMessageShow("Not registered",False)

You would return the registered product and obfuscate doesnt works fine on other addons that doesnt are the main.
 
Last edited:

KashMalaga

Member
Licensed User
Longtime User
You can obfuscate all the strings by assigning them in Sub Process_Globals.

I thinks that obfuscate strings here isnt be the solution if you can see whats function do when app gets registered from google answer
 

KashMalaga

Member
Licensed User
Longtime User
Obfuscation is not encryption. A determinant hacker with enough time will always be able to reverse engineer your code.

Thanks for the information.

And obfuscation just split under hex the string, just example for someone that want to see how works:

Nomal string="hello my friend"

Obfuscated string on smali:
B4X:
.array-data 0x1
        0x51t
        0x4at
        0x42t
        0xbct
        0x46t
        0x58t
        0x41t
        0x60t
        0xcet
    .end array-data
 

canalrun

Well-Known Member
Licensed User
Longtime User
Thank you for the in app billing service library.

I copied your tutorial code into a test program to test things out.
I used the android test purchase product IDs (ex. android.test.purchased)

At first, instead of naming my service module inappbillingservice, I named it BillSrv. When I compiled I got the error something like "Compile inappbillingservice_br not found". When I changed the name of the service module to inappbillingservice, the error went away.

After completing the android.test.purchased purchase and the "thank you for purchasing" message box is displayed, if I did not click okay for 20 seconds or so, I would get an error and "force close" MessageBox from android saying my test app has stopped.

When I look at the ExtraData field in the logs, it is displayed as "null" rather than the string "extra data" as specified in the RequestPayment call.

Thank you for the library. These are not biggies. The library seems to work great – now to test with products I create.

Barry.
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks for the reply.
I tried my test program on 2 devices a Samsung vibrant phone and an Acer A500 tablet. I press the "Buy" button in my app, it goes to Google for in app payments, in Google I press the "Accept & pay" button, it returns to my app and displays the "Thank you for purchasing" dialogue, instead of pressing the okay button I let it display. After about 20 seconds it displays the android "force close" message.

I have included unfiltered logs from the point I press the Google "accept" button for both devices below. I have also attached my zipped project.

Thanks,
Barry.


B4X:
-----------------------------
Samsung SHG-T959
Firmware 2.2
Kernal 2.6.32.9
-----------------------------
Dsptch > Window{47e595a0 com.android.vending/com.google.android.finsky.activities.IabActivity paused=false}
ID[0]=0(0) Dn(0=>1)
ID[0]=0(0) Up(1=>0)
Dsptch > Window{47e595a0 com.android.vending/com.google.android.finsky.activities.IabActivity paused=false}
Ulight 3->7|0
 ALSA OPEN mode 0,device 2 
Try to open ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 2048
Latency: 46439
[1] PurchaseFragment.onStateChange: Finished purchase with ID https://android.clients.google.com/fdfe/purchaseStatus?doc=inapp:canalrun.apps.bill:android.test.purchased&order=transactionId.android.test.purchased
** Service (inappbillingservice) Start **
[7] MarketBillingService.getPreferredAccount: canalrun.apps.bill: Account from first account.
** Activity (main) Resume **
[1] MarketBillingService.sendResponseCode: Sending response RESULT_OK for request 5515239639475740544 to canalrun.apps.bill.
** Service (inappbillingservice) Start **
[1] PendingNotificationsService.setMarketAlarm: Setting alarm for [email protected], duration=120000
** Service (inappbillingservice) Start **
[1] MarketBillingService.sendResponseCode: Sending response RESULT_OK for request 603133647854550131 to canalrun.apps.bill.
PurchaseStateChange: 0
ProductId: android.test.purchased
OrderId: transactionId.android.test.purchased
DateTime: 13:20:02
ExtraData: null
** Service (inappbillingservice) Start **
Timer 0x7->0x3|0x3
Ulight 7->3|0
Process com.flightview.flightview_free (pid 9620) has died.
Output standby called!!. Turn off PCM device.
Ulight 3->7|0
Timer 0x7->0x3|0x0
Ulight 7->3|0
update start
updateBattery level:100 scale:100 status:4 health:2 present:true voltage: 4170 temperature: 270 technology: Li-ion AC powered:false USB powered:false icon:17302175
BAT. status:4 health:2
ACTION_BATTERY_CHANGED pluggedType: 0
Timeout executing service: ServiceRecord{4836f5a8 canalrun.apps.bill/.inappbillingservice}
Sending signal. PID: 9578 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 2496 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 28491 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 2696 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 2713 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 2694 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9487 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 8501 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9687 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9679 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9668 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 17552 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 16250 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 2717 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9651 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9657 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 9359 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9278 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9632 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9584 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9570 SIG: 3
threadid=3: reacting to signal 3
Failed to write stack traces to /data/anr/traces.txt (17831 of 19794): Interrupted system call
Failed to write stack traces to /data/anr/traces.txt (-1 of 2312): Math result not representable
Sending signal. PID: 27787 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 6584 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 9230 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 8875 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 9030 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Failed to write stack traces to /data/anr/traces.txt (1607 of 2804): Unknown error: 0
Sending signal. PID: 3032 SIG: 3
threadid=3: reacting to signal 3
Sending signal. PID: 2723 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 8881 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 8866 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 2716 SIG: 3
threadid=3: reacting to signal 3
Failed to write stack traces to /data/anr/traces.txt (4734 of 7887): Unknown error: 0
Wrote stack traces to '/data/anr/traces.txt'
Wrote stack traces to '/data/anr/traces.txt'
dumpmesg > /data/log/dumpstate_app_anr.log
ANR in canalrun.apps.bill
Reason: Executing service canalrun.apps.bill/.inappbillingservice
Load: 0.93 / 1.04 / 0.64
CPU usage from 115470ms to 45ms ago:
  .android.kineto: 8% = 0% user + 8% kernel / faults: 525 minor 14 major
  system_server: 8% = 4% user + 3% kernel / faults: 19366 minor 509 major
  sensorserver_ya: 3% = 0% user + 3% kernel / faults: 342 minor
  d.process.acore: 3% = 0% user + 2% kernel / faults: 13670 minor 777 major
  mmcqd: 2% = 0% user + 2% kernel
  android.vending: 1% = 0% user + 0% kernel / faults: 5819 minor 251 major
  e.b4a.b4abridge: 1% = 0% user + 0% kernel / faults: 2604 minor 8 major
  kswapd0: 1% = 0% user + 1% kernel
  dhd_dpc: 1% = 0% user + 1% kernel
  m.android.phone: 0% = 0% user + 0% kernel / faults: 1336 minor 17 major
  .app.twlauncher: 0% = 0% user + 0% kernel / faults: 2178 minor 29 major
  mediaserver: 0% = 0% user + 0% kernel / faults: 1028 minor 79 major
  e.process.gapps: 0% = 0% user + 0% kernel / faults: 2164 minor 44 major
  .batterybooster: 0% = 0% user + 0% kernel / faults: 1263 minor 14 major
  zygote: 0% = 0% user + 0% kernel / faults: 1592 minor 1 major
  vold: 0% = 0% user + 0% kernel / faults: 150 minor 6 major
  nputmethod.axt9: 0% = 0% user + 0% kernel / faults: 910 minor 8 major
  equicksearchbox: 0% = 0% user + 0% kernel / faults: 1037 minor 17 major
  rild: 0% = 0% user + 0% kernel / faults: 448 minor 20 major
  LocationService: 0% = 0% user + 0% kernel / faults: 1239 minor 14 major
  kblockd/0: 0% = 0% user + 0% kernel
  wpa_supplicant: 0% = 0% user + 0% kernel / faults: 165 minor 5 major
  pvr_workqueue: 0% = 0% user + 0% kernel
  tvoutserver: 0% = 0% user + 0% kernel / faults: 203 minor 2 major
  oid.voicesearch: 0% = 0% user + 0% kernel / faults: 593 minor 5 major
  com.wssyncmldm: 0% = 0% user + 0% kernel / faults: 967 minor 14 major
  events/0: 0% = 0% user + 0% kernel
  drexe: 0% = 0% user + 0% kernel / faults: 79 minor 1 major
  binder: 0% = 0% user + 0% kernel
  gp2a_wq: 0% = 0% user + 0% kernel
  m.slacker.radio: 0% = 0% user + 0% kernel / faults: 814 minor 18 major
  flush-138:10: 0% = 0% user + 0% kernel
  kcryptd: 0% = 0% user + 0% kernel
  pps.googlevoice: 0% = 0% user + 0% kernel / faults: 451 minor 22 major
  svnetd/0: 0% = 0% user + 0% kernel
  d.process.media: 0% = 0% user + 0% kernel / faults: 627 minor 1 major
  android.app.sns: 0% = 0% user + 0% kernel / faults: 260 minor 4 major
  init: 0% = 0% user + 0% kernel
  qt602240_wq: 0% = 0% user + 0% kernel
  mmcqd: 0% = 0% user + 0% kernel
  servicemanager: 0% = 0% user + 0% kernel / faults: 110 minor 2 major
  notified_event: 0% = 0% user + 0% kernel / faults: 105 minor 4 major
  netd: 0% = 0% user + 0% kernel / faults: 114 minor 4 major
  agpsd: 0% = 0% user + 0% kernel / faults: 21 minor
  paper.dandelion: 0% = 0% user + 0% kernel / faults: 267 minor
  loop0: 0% = 0% user + 0% kernel
  flush-179:0: 0% = 0% user + 0% kernel
  viders.calendar: 0% = 0% user + 0% kernel / faults: 274 minor
 +logcat: 0% = 0% user + 0% kernel
 +martUninstaller: 0% = 0% user + 0% kernel
 +alrun.apps.bill: 0% = 0% user + 0% kernel
 +droid.apps.maps: 0% = 0% user + 0% kernel
 +onFriendService: 0% = 0% user + 0% kernel
 +iders.downloads: 0% = 0% user + 0% kernel
 +tl.mediahub.tmo: 0% = 0% user + 0% kernel
 +d.apps.uploader: 0% = 0% user + 0% kernel
 +ogle.android.gm: 0% = 0% user + 0% kernel
 +com.fsck.k9: 0% = 0% user + 0% kernel
 -martUninstaller: 0% = 0% user + 0% kernel
 -flush-138:6: 0% = 0% user + 0% kernel
 -flush-179:8: 0% = 0% user + 0% kernel
 -flush-138:3: 0% = 0% user + 0% kernel
 -flush-138:11: 0% = 0% user + 0% kernel
 -zygote: 0% = 0% user + 0% kernel
 -onFriendService: 0% = 0% user + 0% kernel
 -zygote: 0% = 0% user + 0% kernel
 -iders.downloads: 0% = 0% user + 0% kernel
 -tl.mediahub.tmo: 0% = 0% user + 0% kernel
 -d.apps.uploader: 0% = 0% user + 0% kernel
 -ogle.android.gm: 0% = 0% user + 0% kernel
 -com.fsck.k9: 0% = 0% user + 0% kernel
 -logcat: 0% = 0% user + 0% kernel
TOTAL: 58% = 13% user + 30% kernel + 11% iowait + 0% irq + 1% softirq
begin
asec list
CommandListener::AsecCmd::runCommand -> anywheresoftware.b4a.samples.camera-1 
done
Process com.google.android.apps.maps:LocationFriendService (pid 9632) has died.
onReceive Enter
RSSI_CHANGED_ACTION newRssi: -55
onReceive Exit
ConnectivityService FeatureUser expire(0, enableHIPRI, android.os.BinderProxy@48475818), created 60006 mSec ago
stopUsingNetworkFeature for net 0: enableHIPRI
ignoring - this process has no outstanding requests
onReceive Enter
RSSI_CHANGED_ACTION newRssi: -68
onReceive Exit
Freeing OpenSSL session
GC_EXPLICIT freed 9630 objects / 878720 bytes in 249ms
ID[0]=0(0) Dn(0=>1)
Dsptch > Window{480cc6a8 Sorry! paused=false}
ID[0]=0(0) Up(1=>0)
Dsptch > Window{480cc6a8 Sorry! paused=false}
Ulight 3->7|0
  Force finishing activity canalrun.apps.bill/.main
Sending signal. PID: 9578 SIG: 9
Killing canalrun.apps.bill (pid=9578): user's request
Process canalrun.apps.bill (pid 9578) has died.
Scheduling restart of crashed service canalrun.apps.bill/.inappbillingservice in 107834ms
WIN DEATH: Window{47cd7208 canalrun.apps.bill/canalrun.apps.bill.main paused=true}
WIN DEATH: Window{48082570 canalrun.apps.bill/canalrun.apps.bill.main paused=true}
** Activity (main) Resume **
Got RemoteException sending setActive(false) notification to pid 9578 uid 10149
 ALSA OPEN mode 0,device 2 
Try to open ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 2048
Latency: 46439
Timer 0x7->0x3|0x0
Ulight 7->3|0
Output standby called!!. Turn off PCM device.

B4X:
-----------------------------
Acer A500
Android 3.2.1
Kernal 2.6.36.3+
-----------------------------
GC_EXPLICIT freed 48K, 5% free 6381K/6659K, paused 6ms+2ms
Alarm type : 2, from setRepeating operation : com.google.android.gsf
[1] PurchaseFragment.onStateChange: Finished purchase with ID https://android.clients.google.com/fdfe/purchaseStatus?doc=inapp:canalrun.apps.bill:android.test.purchased&order=transactionId.android.test.purchased
GC_CONCURRENT freed 393K, 8% free 6566K/7111K, paused 2ms+2ms
** Activity (main) Resume **
lights on
GC_CONCURRENT freed 396K, 7% free 8034K/8583K, paused 2ms+5ms
[1] MarketBillingService.sendResponseCode: Sending response RESULT_OK for request 4226357883067499698 to canalrun.apps.bill.
[1] PendingNotificationsService.setMarketAlarm: Setting alarm for [email protected], duration=120000
Alarm type : 3, from setRepeating operation : com.android.vending
** Service (inappbillingservice) Start **
** Service (inappbillingservice) Start **
[24] MarketBillingService.getPreferredAccount: canalrun.apps.bill: Account from first account.
[1] MarketBillingService.sendResponseCode: Sending response RESULT_OK for request 1537112904129852264 to canalrun.apps.bill.
** Service (inappbillingservice) Start **
PurchaseStateChange: 0
ProductId: android.test.purchased
OrderId: transactionId.android.test.purchased
DateTime: 13:23:19
ExtraData: null
GC_FOR_ALLOC freed 229K, 5% free 6580K/6919K, paused 29ms
Grow heap (frag case) to 7.014MB for 513744-byte allocation
GC_CONCURRENT freed <1K, 5% free 7082K/7431K, paused 2ms+3ms
** Service (inappbillingservice) Start **
lights on
GC_EXPLICIT freed 39K, 9% free 6365K/6983K, paused 6ms+2ms
Timeout executing service: ServiceRecord{40bf1248 canalrun.apps.bill/.inappbillingservice}
Sending signal. PID: 16197 SIG: 3
threadid=4: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 131 SIG: 3
threadid=4: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 245 SIG: 3
threadid=4: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 184 SIG: 3
threadid=4: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
GC_CONCURRENT freed 1221K, 30% free 12298K/17415K, paused 3ms+6ms
GC_EXPLICIT freed 634K, 30% free 12272K/17415K, paused 3ms+5ms
ANR in canalrun.apps.bill
Reason: Executing service canalrun.apps.bill/.inappbillingservice
Load: 0.29 / 1.08 / 0.94
CPU usage from 15796ms to 0ms ago with 99% awake:
  6.6% 131/system_server: 2.8% user + 3.7% kernel / faults: 4 minor
  2.7% 105/dock_detect_daemon: 0.2% user + 2.4% kernel
  0.1% 501/com.acer.android.widget.digitalclock: 0.1% user + 0% kernel / faults: 60 minor
  0.3% 3441/dhd_dpc: 0% user + 0.3% kernel
  0.3% 3/ksoftirqd/0: 0% user + 0.3% kernel
  0.3% 184/com.android.systemui: 0.2% user + 0% kernel / faults: 4 minor
  0.3% 11199/anywheresoftware.b4a.b4abridge: 0.1% user + 0.1% kernel
  0.2% 16239/com.android.vending: 0.1% user + 0.1% kernel / faults: 14 minor
  0.1% 16160/com.google.android.gsf.login: 0.1% user + 0% kernel / faults: 19 minor
  0.1% 16197/canalrun.apps.bill: 0.1% user + 0% kernel
  0.1% 57/kinteractiveup: 0% user + 0.1% kernel
  0.1% 16016/ksoftirqd/1: 0% user + 0.1% kernel
  0% 82/surfaceflinger: 0% user + 0% kernel
  0% 100/irq/182-3d: 0% user + 0% kernel
  0% 3440/dhd_watchdog: 0% user + 0% kernel
  0% 3450/wpa_supplicant: 0% user + 0% kernel
  0% 13594/kworker/0:1: 0% user + 0% kernel
  0% 16227/logcat: 0% user + 0% kernel
5.3% TOTAL: 2.1% user + 3.1% kernel + 0% iowait + 0% softirq
CPU usage from 364ms to 878ms later:
  9.4% 131/system_server: 1.8% user + 7.5% kernel / faults: 1 minor
    3.7% 138/SensorService: 0% user + 3.7% kernel
    3.7% 140/ActivityManager: 0% user + 3.7% kernel
    1.8% 139/er.ServerThread: 0% user + 1.8% kernel
    1.8% 183/er$SensorThread: 1.8% user + 0% kernel
  1.3% 105/dock_detect_daemon: 1.3% user + 0% kernel
    1.3% 105/dock_detect_dae: 1.3% user + 0% kernel
5.8% TOTAL: 1.9% user + 3.9% kernel
  Force finishing activity canalrun.apps.bill/.main
** Activity (main) Pause, UserClosed = true **
Sending signal. PID: 16197 SIG: 9
Killing canalrun.apps.bill (pid=16197): user's request
channel '40be1f68 canalrun.apps.bill/canalrun.apps.bill.main (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
channel '40be1f68 canalrun.apps.bill/canalrun.apps.bill.main (server)' ~ Channel is unrecoverably broken and will be disposed!
Config changed: {1.0 0mcc0mnc en_US sw800dp w800dp h1232dp xlrg port finger -keyb/v/h -nav/h s.19}
WIN DEATH: Window{40be1f68 canalrun.apps.bill/canalrun.apps.bill.main paused=true}
WIN DEATH: Window{40b75510 canalrun.apps.bill/canalrun.apps.bill.main paused=true}
WINDOW DIED Window{40be1f68 canalrun.apps.bill/canalrun.apps.bill.main paused=true}
updateProximitySensorMode: state = IDLE
Process canalrun.apps.bill (pid 16197) has died.
Scheduling restart of crashed service canalrun.apps.bill/.inappbillingservice in 63144ms
** Activity (main) Resume **
lights on
Got RemoteException sending setActive(false) notification to pid 16197 uid 10110
GC_EXPLICIT freed 986K, 31% free 12121K/17415K, paused 10ms+4ms
--- from triggerAlarmsLocked operation: com.acer.android.widget.digitalclock
----Alarm type: 1Second:1329071400.0
Alarm type : 1, from setRepeating operation : android
----Alarm type: 1Second:1329071100.0
 

Attachments

  • Bill.zip
    7.5 KB · Views: 339

Inman

Well-Known Member
Licensed User
Longtime User
Are InApp purchases just like normal app purchases on Android Market (where the buyer can use the app on all his devices with the same Google account) or is the purchase restricted to only that device from which the inapp transaction was completed?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
@canalrun, this error will only happen with the test keys. The test messages are not properly signed.
From my experience it is easier (and more reliable) to create some real low cost products and test them.

@Inman, managed transactions are not restricted to the device. When your program runs for the first time (only after installation) you should call RestoreTransactions to retrieve the previously purchased managed items.
 

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I am having some trouble using the In App Billing Library. I have a test application based on the tutorial code, I have uploaded unpublished, created a product, been able to make test purchases, and have them show up in my market account.

I am using un-managed products.

The problem comes in with the responses I am getting in PurchaseStateChange (PSC).

1) There is no way to cancel a purchase other than hitting the "back" button when in the Google portion of check out. But, hitting the back button does not generate the PSC "cancel" message. My app gets no kind of notification that the buyer canceled.

2) I made a purchase then canceled the purchase in the Google marketplace. I then made another purchase. From the second purchase I got a PSC of "your transaction was canceled". I looked on the Google Marketplace and there was a record showing a charge for the second purchase. The "transaction canceled" message showed a dialog box that came from somewhere – nowhere in my code. I think that "transaction canceled" message was referring to the first transaction which I had canceled in the Google marketplace. My app had no way of knowing that and had no notification of the valid purchase. I think this is what the "nonce" parameter is for – to identify the transaction related to the message. This parameter is not available in the library.

About 10 seconds after receiving the "transaction canceled" message, the app crashed with an Android force close.

I have seen complaints posted on the net about the variable length of time between a user clicking "Accept & Pay" in the Google checkout and the app receiving a PSC for the transaction.

How should I be coordinating my payment requests with the PSC's that come back from Google? My experiments with "extra data strings" come back as null in the PSC?

Any Suggestions?

Thanks,
Barry.
 

canalrun

Well-Known Member
Licensed User
Longtime User
1) The "cancel" message means that the order was canceled. Not that the process was canceled in the middle. You should build your application in such a way that it only reacts to successful transactions.

2) You should use managed products if you want to handle refunds and cancels.

Thanks.

But, managed products have the fatal flaw that you could only buy one of something – this is only applicable to a certain class of products.

I don't want to handle cancels and refunds. When I canceled a previous transaction, in response to my next test purchase I received a MessageBox from somewhere (nowhere is it in my code) saying "transaction canceled". I have a feeling this was due to the previous purchase I had canceled in my market account, not my current purchase. There was no way to detect this message box popping up, there was no indication that it probably referred to a prior transaction, there was no indication in the app that the current transaction succeeded (I received no indication that I should credit that purchase. Although the charge showed up in my market account), and 10 seconds later the app crashed with a "force close".

As of now I am getting seemingly random messages and not getting reports of valid purchases.

How can I relate the PurchaseStateChange to the transaction for which it pertains.

Where does this message box that popped up for the cancel PSC come from?

Thanks,
Barry.
 
Top