Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,739,332 Members 52,931 Now Online
XDA Developers Android and Mobile Development Forum

[Q] In-App-Billing

Tip us?
 
ueen
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Feb 2014
Exclamation [Q] In-App-Billing

Hello,
i've some issues to implement the in-app-billing system; here'S the code:

Code:
Select Code
		 case R.id.item2:
		    new Thread(new Runnable() {
		        public void run() {
		        	ArrayList<String> skuList = new ArrayList<String> ();
		        	skuList.add("developersupported");
		        	Bundle querySkus = new Bundle();
		        	querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
		        	
		        	try {
						Bundle skuDetails = mService.getSkuDetails(3, 
								   getPackageName(), "inapp", querySkus);
						
						int response = skuDetails.getInt("RESPONSE_CODE");
						if (response == 0) {
						   ArrayList<String> responseList
						      = skuDetails.getStringArrayList("DETAILS_LIST");
						   
						   for (String thisResponse : responseList) {
						      JSONObject object = new JSONObject(thisResponse);
						      String sku = object.getString("productId");
						      String price = object.getString("price");
						      //if (sku.equals("sup")) mPremiumUpgradePrice = price;
						   }
						}

						
					} catch (RemoteException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (JSONException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
		        	
		        	
		        	
		        }
		    }).start();	
		   
			try {
				 Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
							"developersupported", "inapp", "payed");
					
					PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
					
				startIntentSenderForResult(pendingIntent.getIntentSender(),
						   1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
						   Integer.valueOf(0));
			} catch (SendIntentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (RemoteException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
The code is from the documentaion "Implementing In-app Billing (IAB Version 3)".
the app conmects to google but the after loaing, theres this error like "your product wasnt found".
If the code correct? i set up an item in the developer console with the name "developersupported".
If you wanna try, the app is called "Clapperboard" in the Play Store
Thanks in advance!
ueen
 
boggartfly
Old
#2  
boggartfly's Avatar
Member
Thanks Meter 10
Posts: 53
Join Date: Dec 2011
Location: Mumbai

 
DONATE TO ME
Sometimes it takes a while for Google's servers to understand that you actually launched a new IAP item. What you can do is:-
1)Sign and export your apk and then upload it as draft . Using the same apk test it locally.
2)Also I recommend using the updated Billing v3 API. The previous v3 had some bugs and it hence has been fixed.
3)Wait and watch. You'll find the item in some hours....

I've had this experience with this.
Pls Give a thanks if this post helped you!

Sent from my Nexus 4 using XDA Premium 4 mobile app
The Following User Says Thank You to boggartfly For This Useful Post: [ Click to Expand ]
 
ueen
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Feb 2014
Quote:
Originally Posted by boggartfly View Post
Sometimes it takes a while for Google's servers to understand that you actually launched a new IAP item. What you can do is:-
1)Sign and export your apk and then upload it as draft . Using the same apk test it locally.
2)Also I recommend using the updated Billing v3 API. The previous v3 had some bugs and it hence has been fixed.
3)Wait and watch. You'll find the item in some hours....

I've had this experience with this.
Pls Give a thanks if this post helped you!

Sent from my Nexus 4 using XDA Premium 4 mobile app
Well i waited over 12h and it still doesnt work.
whats that with the updated v3? I cant post links but if xou go to the devloper android page heres the path /google/play/billing/billing_integrate.html theres the code from.
Is the code correct?
I published the non app with the nonfunctionable in-app-billing and i really like to fix this fast! Please help!
 
boggartfly
Old
#4  
boggartfly's Avatar
Member
Thanks Meter 10
Posts: 53
Join Date: Dec 2011
Location: Mumbai

 
DONATE TO ME
Quote:
Originally Posted by ueen View Post
Hello,
i've some issues to implement the in-app-billing system; here'S the code:

Code:
Select Code
		 case R.id.item2:
		    new Thread(new Runnable() {
		        public void run() {
		        	ArrayList<String> skuList = new ArrayList<String> ();
		        	skuList.add("developersupported");
		        	Bundle querySkus = new Bundle();
		        	querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
		        	
		        	try {
						Bundle skuDetails = mService.getSkuDetails(3, 
								   getPackageName(), "inapp", querySkus);
						
						int response = skuDetails.getInt("RESPONSE_CODE");
						if (response == 0) {
						   ArrayList<String> responseList
						      = skuDetails.getStringArrayList("DETAILS_LIST");
						   
						   for (String thisResponse : responseList) {
						      JSONObject object = new JSONObject(thisResponse);
						      String sku = object.getString("productId");
						      String price = object.getString("price");
						      //if (sku.equals("sup")) mPremiumUpgradePrice = price;
						   }
						}

						
					} catch (RemoteException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (JSONException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
		        	
		        	
		        	
		        }
		    }).start();	
		   
			try {
				 Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
							"developersupported", "inapp", "payed");
					
					PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
					
				startIntentSenderForResult(pendingIntent.getIntentSender(),
						   1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
						   Integer.valueOf(0));
			} catch (SendIntentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (RemoteException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
The code is from the documentaion "Implementing In-app Billing (IAB Version 3)".
the app conmects to google but the after loaing, theres this error like "your product wasnt found".
If the code correct? i set up an item in the developer console with the name "developersupported".
If you wanna try, the app is called "Clapperboard" in the Play Store
Thanks in advance!
ueen
Use the samples available for In app billing . What you can do is extract code which is suitable and port it to where you want. Also copy relevant class files. Please also give credit to the original developer who wrote the code as it is kanging someone else's code..

That's the easiest way to get up and running. Don't worry about anything else buddy. Keep coding.
 
ueen
Old
#5  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Feb 2014
ok i solved the issue by de installing the debug vrsion and installing the appstore version of my app.
thanks for your support.
btw: i used the samples from the google android documentation.
 
boggartfly
Old
#6  
boggartfly's Avatar
Member
Thanks Meter 10
Posts: 53
Join Date: Dec 2011
Location: Mumbai

 
DONATE TO ME
Quote:
Sometimes it takes a while for Google's servers to understand that you actually launched a new IAP item. What you can do is:-
1)Sign and export your apk and then upload it as draft . Using the same apk test it locally.
2)Also I recommend using the updated Billing v3 API. The previous v3 had some bugs and it hence has been fixed.
3)Wait and watch. You'll find the item in some hours....

I've had this experience with this.
Pls Give a thanks if this post helped you! 

Sent from my Nexus 4 using XDA Premium 4 mobile app
I told you. See point number 1.
Also do read the other documentation if necessary.

Please give a thanks if you think this post helped you!

Sent from my Nexus 4 using XDA Premium 4 Mobile App .
The Following User Says Thank You to boggartfly For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Device Review: OnePlus One

Seemingly every day, there are a bunch of new devices being released. Some are budget devices and some are … more

Browse the Internet with the Innovative Atlas Web Browser

For the most part, Chrome, Firefox, and Dolphin Browser have no real rivals among … more

Choose from Over a Thousand Battery Styles with 3Minit Battery Mod

The battery style in stock Android looks pretty dull. It doesn’t … more

Organize Your Cloud Storage Files with Unclouded

Cloud storage services like Dropbox or Google Drive have grown in popularity dramatically … more