See this tutorial for more information: http://www.b4x.com/forum/basic4andr...rials/14608-android-app-billing-tutorial.html
You should use the BillingSupported event for this.PS. I would like to modify this lib to add some functions like return string for support inapppayment
at anywheresoftware.b4a.keywords.Common.Msgbox(Common.java:383)
at com.kash.test.inappbillingservice._manager_purchasestatechange(inappbillingservice.java:105)
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
You can obfuscate all the strings by assigning them in Sub Process_Globals.
Obfuscation is not encryption. A determinant hacker with enough time will always be able to reverse engineer your code.
.array-data 0x1
0x51t
0x4at
0x42t
0xbct
0x46t
0x58t
0x41t
0x60t
0xcet
.end array-data
-----------------------------
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 account=canalrun1@gmail.com, 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.
-----------------------------
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 account=canalrun2@gmail.com, 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
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.