Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
inapp on android — Gideros Forum

inapp on android

GiderosFanGiderosFan Member
edited July 2015 in General questions
Hey,

i tried to make me an sample for inapp purchasing but it seems that the playstore don't support Darft Apps.

how can i check that my app works correctly on purchasing..
--require plugin
require "iab"
 
--create iab instance based on store you want to use
 
	iab = IAB.new("google")
 
	--provide key(s) needed for the store
	iab:setUp("base code from playstore") --> base64 code from playstore right
 
	--provide list of products you will be using 
	--(key is your internal products id, value is store specific product id)
	iab:setProducts({p1 = "product_001", p2 = "product_002"})
 
 
--which of your products are consumables, 
--that people can buy many times (provide internal product ids)
iab:setConsumables({"p1", "p2"})
 
--[[ CHECKING IF STORE IS AVAILABLE ]]--
iab:addEventListener(Event.AVAILABLE, function(e)
	print("is available")
	--usually here we would set a flag that it is possible to make purchases
	--basically you can allow doing all the iap stuff after this event is called
 
	--[[ REQUESTING PRODUCTS ]]--
	--if this event is called, we received the list of products and information about them
	iab:addEventListener(Event.PRODUCTS_COMPLETE, function(e)
		for i = 1, #e.products do
			local p = e.products[i]
			--id, title, description and price
			print(p.productId, p.title, p.description, p.price)
		end
	end)
 
	iab:addEventListener(Event.PRODUCTS_ERROR, function(e)
		print(e:getType(), e.error)
	end)
 
	--requesting products
	iab:requestProducts()
 
	--[[ PURCHASING ]]--
 
	iab:addEventListener(Event.RESTORE_COMPLETE, function(e)
 
	end)
 
 
	iab:addEventListener(Event.PURCHASE_COMPLETE, function(e)
	for i = 1, #e.products do
			local p = e.products[i]
	if p.productId == 1 then
	print ("Product 1 should be successful bought")
end
	if p.productId == 2 then
	print ("Product 2 should be successful bought")
end
 
	end)
 
 
	iab:addEventListener(Event.PURCHASE_ERROR, function(e)
		Print("Error on Purchasing")
	end)
 
end)
iab:isAvailable()

So my question is how can i check that the app runs correctly. i read about android.test.purchased but if i run this i can just 1 time bought but they code after purchasing don't run and i need multiple boughts (consumable).

maybe anyone have tips for me or an little working example for iab.

Comments

  • I spent a lot of time recently trying to test in-app purchase functionality. I finally got my app to compile and not crash. I had to test on an actual device because it would crash the emulator I use (Genymotion). I did, finally, get it to give me a "Billing not available" error which means it is at least communicating with Google. Anyway, from what I understand, you have to upload your apk for alpha testing in the Google Developer Console. You have to publish the app to alpha before you can actually test for purchases. In order to do that, you have to upload all of the required images for the store. You also have to create a Google+ account to use for the alpha testing, and you can't use the same Google account on your test device that you use to log into the Developer Console. I haven't gotten that far yet, but I think I can start testing once I come up with the images for the store. It is definitely not a simple task to test in-app purchases anymore.

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
  • Thank you for sharing your experience with me. I think it would be a far way to get running InApp but i will try it. Thank you. That looks like a long long and sleepless weekend.

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
  • If and when I do get everything working, I will try to make a "complete" step-by-step tutorial for in-app purchases using Google billing. I have found that creating apps and learning Gideros is the easy part... getting the app to market is a nightmare. I read all of the great information here in the forum, muddle through the extensive documentation on the Google Developer site, and scour the internet for bits and pieces of additional info and user experience. Then, I put all of that information together and, eventually, get things to work. I only deal with Android right now, I don't have any experience with Apple.

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
  • piepie Member
    Just one more thing (never tried iap, but used alpha/beta publishing): google plus (which I personally don't like) is not mandatory, I think that you can also use google groups to gather your tester accounts.

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
  • @pie, I think you are right about Google+ and Google groups. I was trying to remember what I had read, I haven't actually gotten that far yet :-)

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
  • GiderosFanGiderosFan Member
    edited July 2015
    yes..

    you need create an google group on googlegroups.com and set this group in the developer account for example your testing group called "mytestinggroup" then you must setup this as mytestinggroup@googlegroup.com and all people which are in the group get information about your product and can download it by an special alpha release link. btw. my inapp working :) long night but it works yet.

    about apple @freessp this is not so complicated because on StoreKit and Apple Allows very easy and quick InApp Tests. No creation of groups etc... just setting up sandbox user accounts :)

    Thank you very much @freessp

  • Glad to help. :D

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.