[TUT] Simple InApp Billing / Payment

Tutorials with advanced 'difficulty' and more Lines of Code.

Re: [TUT] Simple InApp Billing / Payment

Postby blundell » Thu Oct 27, 2011 12:47 pm

Yep you've got it, keep a list within your app.

Or keep a list on your own server and get it from there.
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Re: [TUT] Simple InApp Billing / Payment

Postby vishal.trivedi » Tue Nov 01, 2011 10:49 am

Thank you very much for the tutorial....
lucid indeed
But i have 1 querry what if i wish to have a subscription based app, like some magazine subscrpitn
Then how do i communicate with my Content Server(where magazines are stored)
and also is it nice to have Security class on my server[It will only check if its a valid app based on public key],but how do i verify the type of subscription (monthly,annual etc) payment made by user and is there a way for my Content Server to communicate with Market for this verification like if market generates some kind of reciept..

"thats actually not a single querry but need help..."

Thanks
vishal.trivedi
Junior Developer
Junior Developer
 
Posts: 16
Joined: Wed Sep 28, 2011 4:21 am

Re: [TUT] Simple InApp Billing / Payment

Postby karthikk » Wed Nov 16, 2011 8:21 am

Hi,
I'm facing the Signature verification failed error and this is returned after purchasing the test item from the market. Using android.test.purchased.

My signatures are absolutely correct on the BillingSecurity.java file in Line 136. But still, this error is being thrown. Kindly help me out! Here's the LogCat response:

11-16 12:48:38.011: E/BillingService(2804): Signature verification failed.
11-16 12:48:38.011: W/BillingService(2804): signature does not match data.
11-16 12:48:38.011: D/BillingService(2804): BillingHelper.verifyPurchase error. purchases was null
11-16 12:48:38.015: I/BillingService(2804): Transaction complete
11-16 12:48:38.015: D/AndroidRuntime(2804): Shutting down VM
11-16 12:48:38.015: W/dalvikvm(2804): threadid=1: thread exiting with uncaught exception (group=0x40015578)
11-16 12:48:38.015: E/AndroidRuntime(2804): FATAL EXCEPTION: main
11-16 12:48:38.015: E/AndroidRuntime(2804): java.lang.NullPointerException
11-16 12:48:38.015: E/AndroidRuntime(2804): at com.wipro.IABVideoActivity$1.handleMessage(IABVideoActivity.java:51)
11-16 12:48:38.015: E/AndroidRuntime(2804): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 12:48:38.015: E/AndroidRuntime(2804): at android.os.Looper.loop(Looper.java:123)
11-16 12:48:38.015: E/AndroidRuntime(2804): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-16 12:48:38.015: E/AndroidRuntime(2804): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 12:48:38.015: E/AndroidRuntime(2804): at java.lang.reflect.Method.invoke(Method.java:507)
11-16 12:48:38.015: E/AndroidRuntime(2804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
11-16 12:48:38.015: E/AndroidRuntime(2804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
11-16 12:48:38.015: E/AndroidRuntime(2804): at dalvik.system.NativeStart.main(Native Method)
11-16 12:48:45.230: I/Process(2804): Sending signal. PID: 2804 SIG: 9
karthikk
Freshman
Freshman
 
Posts: 5
Joined: Wed Nov 16, 2011 8:05 am

Re: [TUT] Simple InApp Billing / Payment

Postby Sakthi Sai » Wed Nov 23, 2011 10:44 am

Hi,
I have downloaded the above application and ran on emulator.. I dont set the public key also.. I dont know what I do after download and import it.. please guide me.. I am new to this community..
Sakthi Sai
Freshman
Freshman
 
Posts: 8
Joined: Wed Nov 23, 2011 9:28 am

Re: [TUT] Simple InApp Billing / Payment

Postby laipsul » Thu Dec 29, 2011 8:36 am

Getting information from the server error occurred.
T_T Why can not I did
laipsul
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Dec 28, 2011 9:48 am

Re: [TUT] Simple InApp Billing / Payment

Postby Himanshu » Thu Dec 29, 2011 8:40 am

Hi i am getting the following error on stack trace when i am using this sample code, i have written my public key.
where i am doing the wrong?? Please share ur thoughts ??

12-29 12:50:27.694: ERROR/BillingService(3741): Signature verification failed.
12-29 12:50:27.698: WARN/BillingService(3741): signature does not match data.
12-29 12:50:27.706: DEBUG/AndroidRuntime(3741): Shutting down VM
12-29 12:50:27.706: WARN/dalvikvm(3741): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): FATAL EXCEPTION: main
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): java.lang.RuntimeException: Unable to start receiver com.blundell.test.BillingReceiver: java.lang.NullPointerException
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2821)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.app.ActivityThread.access$3200(ActivityThread.java:125)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.os.Handler.dispatchMessage(Handler.java:99)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.os.Looper.loop(Looper.java:123)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at java.lang.reflect.Method.invokeNative(Native Method)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at java.lang.reflect.Method.invoke(Method.java:521)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at dalvik.system.NativeStart.main(Native Method)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): Caused by: java.lang.NullPointerException
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at com.blundell.test.BillingHelper.verifyPurchase(BillingHelper.java:249)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at com.blundell.test.BillingReceiver.purchaseStateChanged(BillingReceiver.java:46)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at com.blundell.test.BillingReceiver.onReceive(BillingReceiver.java:29)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2810)
12-29 12:50:27.722: ERROR/AndroidRuntime(3741): ... 10 more
Himanshu
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Dec 29, 2011 8:36 am

Top

Re: [TUT] Simple InApp Billing / Payment

Postby blundell » Mon Jan 02, 2012 2:16 pm

@Himanshu you must have written your public key wrong
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: [TUT] Simple InApp Billing / Payment

Postby Sweety » Tue Jan 03, 2012 6:32 am

Hi i am getting the following error on stack trace when i am using this sample code, i have not written my public key.
because when i open the debud.keystore file. i don't understant which is the key. Please tell me the proper way to make this application run in proper way. Now the status is that the button "YES!!" is click but nothing happens.
Please help me..


01-03 09:53:47.963: INFO/Launcher(131): setLoadOnResume
01-03 09:53:48.193: INFO/BillingService(441): Starting
01-03 09:53:48.404: DEBUG/dalvikvm(441): GC_EXTERNAL_ALLOC freed 46K, 53% free 2551K/5379K, external 716K/1038K, paused 102ms
01-03 09:53:48.563: INFO/BillingService(441): Service starting with onCreate
01-03 09:53:48.574: WARN/ActivityManager(69): Unable to start service Intent { act=com.android.vending.billing.MarketBillingService.BIND }: not found
01-03 09:53:48.574: ERROR/BillingService(441): Market Billing Service could not be bound.
01-03 09:53:48.993: INFO/ActivityManager(69): Displayed com.blundell.test/.AppMainTest: +1s791ms
01-03 09:53:52.383: INFO/StagefrightPlayer(34): setDataSource('/system/media/audio/ui/Effect_Tick.ogg')
01-03 09:53:52.393: ERROR/BillingService(441): BillingHelper not fully instantiated
01-03 09:53:52.393: INFO/BillingService(441): Can't purchase on this device
01-03 09:53:52.414: ERROR/MediaPlayer(69): error (1, -2147483648)
01-03 09:53:52.414: WARN/AudioService(69): MediaPlayer IOException: java.io.IOException: Prepare failed.: status=0x1
01-03 09:53:53.743: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 68K, 53% free 2817K/5959K, external 8654K/8654K, paused 83ms
01-03 09:54:01.703: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 68K, 53% free 2817K/5959K, external 8654K/8654K, paused 64ms
01-03 09:54:09.733: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2817K/5959K, external 8654K/8654K, paused 81ms
01-03 09:54:17.733: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2817K/5959K, external 8654K/8654K, paused 66ms
01-03 09:54:25.753: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2817K/5959K, external 8654K/8654K, paused 82ms
01-03 09:54:33.773: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2817K/5959K, external 8654K/8654K, paused 65ms
01-03 09:54:41.733: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2817K/5959K, external 8654K/8654K, paused 81ms
01-03 09:54:49.723: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2817K/5959K, external 8654K/8654K, paused 64ms
01-03 09:54:57.763: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 79ms
01-03 09:55:05.733: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 65ms
01-03 09:55:13.783: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 82ms
01-03 09:55:21.713: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 64ms
01-03 09:55:29.763: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 82ms
01-03 09:55:37.763: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 64ms
01-03 09:55:45.744: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 82ms
01-03 09:55:53.703: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 64ms
01-03 09:56:01.793: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 85ms
01-03 09:56:09.703: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 63ms
01-03 09:56:41.763: DEBUG/dalvikvm(369): GC_EXTERNAL_ALLOC freed 67K, 53% free 2816K/5959K, external 8654K/8654K, paused 63ms
01-03 09:57:13.123: DEBUG/SntpClient(69): request time failed: java.net.SocketException: Address family not supported by protocol
01-03 10:02:13.163: DEBUG/SntpClient(69): request time failed: java.net.SocketException: Address family not supported by protocol
Sweety
Freshman
Freshman
 
Posts: 5
Joined: Sat Oct 15, 2011 10:54 am

Re: [TUT] Simple InApp Billing / Payment

Postby xdebugx » Wed Jan 04, 2012 11:00 pm

Are you trying this on the emulator? The error your getting is "Cannont purchase on this device." It will not work on the emulator.

The media player exception your getting is most likely caused by it not finding the data source: setDataSource('/system/media/audio/ui/Effect_Tick.ogg')
xdebugx
Junior Developer
Junior Developer
 
Posts: 24
Joined: Fri Apr 02, 2010 4:06 am

Re: [TUT] Simple InApp Billing / Payment

Postby androidstudio » Mon Jan 09, 2012 4:17 pm

This is an excellent tutorial, thank you!

I have just wasted a lot of time looking at the official sample app whilst trying to resolve the trillion bugs in there. On the other hand this tutorial is simple, easy to digest and works.
androidstudio
Freshman
Freshman
 
Posts: 4
Joined: Wed Dec 05, 2007 11:14 am

Re: [TUT] Simple InApp Billing / Payment

Postby Murali5115 » Thu Jan 12, 2012 8:41 am

Hi am developing one in-app purchasing app so i used the following code and im getting the following error please help me out this issue.

Error in logcat:

01-11 18:02:26.080: E/BillingService(571): Market Billing Service could not be bound.
01-11 18:02:28.879: E/BillingService(571): BillingHelper not fully instantiated
Murali5115
Freshman
Freshman
 
Posts: 4
Joined: Thu Jan 12, 2012 8:36 am

Re: [TUT] Simple InApp Billing / Payment

Postby blundell » Thu Jan 12, 2012 9:31 am

Murall, take a look at BillingHelper.java line 571, this will tell you why it show's that error
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: [TUT] Simple InApp Billing / Payment

Postby Murali5115 » Thu Jan 12, 2012 1:49 pm

Yeah i got fix this issue now im getting one more issue like when im clicking the 'Yes" button am unable to get any response from any thing, app is idle.

One thing is i have installed android market application manually( got apk file installed from desktop ) and unable to configure account in android market its saying " have to add account select yes to configure bt on selcting yes nothing is happening"

Please help me out this i need to do lot of work.. respond asap..
Murali5115
Freshman
Freshman
 
Posts: 4
Joined: Thu Jan 12, 2012 8:36 am

Re: [TUT] Simple InApp Billing / Payment

Postby Murali5115 » Tue Jan 17, 2012 2:19 pm

Can some one please respond to the earlier comment. So that i can move on to another feature...

Please respond asap...
Murali5115
Freshman
Freshman
 
Posts: 4
Joined: Thu Jan 12, 2012 8:36 am

Re: [TUT] Simple InApp Billing / Payment

Postby karthikk » Tue Jan 24, 2012 6:46 am

Hi,
I'm getting this eror. Could you please help me out in restore transactions?
Code: Select all
01-24 11:05:57.880: E/BillingService(4331): data is null
01-24 11:05:57.880: D/AndroidRuntime(4331): Shutting down VM
01-24 11:05:57.880: W/dalvikvm(4331): threadid=1: thread exiting with uncaught exception (group=0x40263760)
01-24 11:05:57.880: E/AndroidRuntime(4331): FATAL EXCEPTION: main
01-24 11:05:57.880: E/AndroidRuntime(4331): java.lang.RuntimeException: Unable to start receiver com.wipro.stem.BillingReceiver: java.lang.NullPointerException
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:1911)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.app.ActivityThread.access$2400(ActivityThread.java:122)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1055)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.os.Looper.loop(Looper.java:132)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.app.ActivityThread.main(ActivityThread.java:4028)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at java.lang.reflect.Method.invokeNative(Native Method)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at java.lang.reflect.Method.invoke(Method.java:491)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at dalvik.system.NativeStart.main(Native Method)
01-24 11:05:57.880: E/AndroidRuntime(4331): Caused by: java.lang.NullPointerException
01-24 11:05:57.880: E/AndroidRuntime(4331):    at com.stem.BillingHelper.verifyPurchase(BillingHelper.java:297)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at com.stem.BillingReceiver.purchaseStateChanged(BillingReceiver.java:44)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at com.stem.BillingReceiver.onReceive(BillingReceiver.java:27)
01-24 11:05:57.880: E/AndroidRuntime(4331):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:1904)
01-24 11:05:57.880: E/AndroidRuntime(4331):    ... 10 more
karthikk
Freshman
Freshman
 
Posts: 5
Joined: Wed Nov 16, 2011 8:05 am

Top
PreviousNext

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests