Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 27
  1. #11
    nr1
    nr1 is offline
    Member
    Join Date
    Feb 2013
    Posts
    51
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Quote Originally Posted by gcc View Post
    For me SharedPfefs Way looks good than firing query to Google-Play whenever user opens the App. Have you tried and found it right?
    Is it safe to store the Purchased Flag in sharedprefs?
    I won't do it with SharedPref, i will always use the Google-Play service on application startup to check which items were purchased and which not.
    Why?
    To me creating shared prefs just means some more code making everything more complex without having a real benefit (and shared prefs can also easily be hacked).


    I finally took the code out of the Google Example i posted above. This example contains a demo for all different types of items and how to deal with them.
    Weakness of this demo is, that some things that are needed for getting a safe solution that can be used on live environment aren't fully realized / explained (especially the 'verifyDeveloperPayload()' and payload when purchasing part, can anyone explain?).


    I also already started testing the In-App stuff of my App directly out of Eclipse. This seems to be complex and tricky, because of different application signatures (production vs. debug) and so on. To be able to purchase something like a 'Remove Ads' item (can of course only be bought once in real life) multiple times (as you will need for testing), you have to immediately 'consume' the purchased item for testing and such things. (That's only what i experienced till now).

    Sometimes i think it would be easier to integrate something like a webview leading to paypal and selling stuff via this somehow. Would also have the positive impact of not loosing 30% of the amount to G**gle.

  2. #12
    gcc
    gcc is offline
    Senior Member
    Join Date
    Aug 2013
    Posts
    1,322
    Post Thanks / Like
    Mentioned
    59 Post(s)
    I finally took the code out of the Google Example i posted above. This example contains a demo for all different types of items and how to deal with them.
    Weakness of this demo is, that some things that are needed for getting a safe solution that can be used on live environment aren't fully realized / explained (especially the 'verifyDeveloperPayload()' and payload when purchasing part, can anyone explain?).
    Can not comment on this. i am still reading tutorials. may be by tomorrow or beyond i will be able to comment.

    Sometimes i think it would be easier to integrate something like a webview leading to paypal and selling stuff via this somehow. Would also have the positive impact of not loosing 30% of the amount to G**gle.
    I too feel that 30% of revenue share is huge. but what is the choice? i do not think you can integrate it via paypal/something and bypass google.
    Looks like it is bad, still you have to opt for this

    there should be only 5% revenue share with google .

  3. #13
    nr1
    nr1 is offline
    Member
    Join Date
    Feb 2013
    Posts
    51
    Post Thanks / Like
    Mentioned
    3 Post(s)
    I'm currently also working on an InAppBilling Manager class (based on the iab utils from google example).
    Goal is to make it really easy to implement the In-App stuff in your own apps.

    Will post it here for common work on it, when it's ready for being released as prototype.

  4. #14
    gcc
    gcc is offline
    Senior Member
    Join Date
    Aug 2013
    Posts
    1,322
    Post Thanks / Like
    Mentioned
    59 Post(s)
    App which has Billing Permission in manifest file and includes In-App-Products marked as Paid App in GP?

    I was Filling details under "Pricing & Distribution" and it only allows to set price for IAP when we choose it as PAID only.
    Please share your experience on this. I do not my App appeared as Paid in GP.

  5. #15
    Senior Member
    Join Date
    Mar 2012
    Posts
    945
    Post Thanks / Like
    Mentioned
    67 Post(s)
    Take a look at: https://github.com/onepf/OpenIAB

    Note: I have not yet tried to implement it... it might be horridly buggy/etc.
    SVEN Studios Corp
    WordHero - realtime multiplayer 4x4 grid word game
    Anagram Hero - realtime multiplayer Anagram finding word game
    WordSearch Hero - realtime multiplayer Wordsearch word game
    Math Hero - realtime multiplayer Math game
    Avatar Hero - Create your own Avatar

  6. #16
    nr1
    nr1 is offline
    Member
    Join Date
    Feb 2013
    Posts
    51
    Post Thanks / Like
    Mentioned
    3 Post(s)
    So finally after some hours of working i can publish first draft of In-App-Billing Manager class(es) that should make it very easy to integrate the in-app-billing v3 into existing apps.

    The sources consist of three packages:
    com.android.vending.billing => Some google stuff needed for IAB
    inappbilling => my work
    inappbilling_util => Some helper classes, taken from google iab example (that i posted before)

    To integrate IAB into an app:
    1. Edit the 'InAppBillingSetup.java' file in the 'inappbilling' folder
    => insert your app base 64 encoded key (you will find it in the google play developer console)
    => define your items to be sold

    2. Add the ManagerClass to your activity:
    Code:
    	InAppBillingManager iabManager;
    	mIsPremium Boolean;
    
    	/** Called when the activity is first created. */
    	public void onCreate(Bundle savedInstanceState)
    	{
    		super.onCreate(savedInstanceState);
    
    		iabManager = new InAppBillingManager(this, this);
    		iabManager.setIabSetupFinishedListener(new OnIabSetupFinishedListener()
    		{
    			@Override
    			public void onEvent(Boolean success, String errorMesssage)
    			{
                                    //do something for example
    				mIsPremium = false;
    
    				if (success == true)
    				{
    					mIsPremium = InAppBillingSetup.IAB_SKU_REMOVE_ADS.Purchased();
    				} else
    					alert("Error occurred!\n" + errorMesssage);
    			}
    
    		});
    
    		iabManager.setPurchaseFinishedListener(new OnPurchaseFinishedListener()
    		{
    			@Override
    			public void onEvent(Boolean success, String errorMesssage, InAppBillingItem item)
    			{
    				if (success == true)
    				{
    					// if no ads item was purchased
    					if (item.Id().equals(InAppBillingSetup.IAB_SKU_REMOVE_ADS.Id()))
    						//do something;
    				} else
    					alert("Error occurred!\n" + errorMesssage);
    			}
    		});
    	}
    
    	@Override
    	protected void onActivityResult(int requestCode, int resultCode, Intent data)
    	{
    		if (iabManager == null)
    			return;
    
    		// Pass on the activity result to the helper for handling
    		if (!iabManager.handleActivityResult(requestCode, resultCode, data))
    		{
    			// not handled, so handle it ourselves (here's where you'd
    			// perform any handling of activity results not related to in-app
    			// billing...
    			super.onActivityResult(requestCode, resultCode, data);
    		} else
    		{
    			;
    		}
    	}
    
    	@Override
    	public void onDestroy()
    	{
    		super.onDestroy();
    		if (iabManager != null)
    			iabManager.dispose();
    	}
    3. Purchase / consume items, for example like:
    Code:
    				iabManager.purchaseItem(InAppBillingSetup.IAB_SKU_REMOVE_ADS, true, true);
    
    				iabManager.consumeItem(InAppBillingSetup.XXX);
    Note:
    Those classes are something as a first prototype, so they aren't fully tested => Errors may occur.
    Currently i don't recommend to already use them in production.
    Maybe someone can look over the code and check.
    Please send me PM if you would like to contribute and also publish any changed final code.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by nr1; 2014-01-05 at 09:31 PM.

  7. #17
    Member
    Join Date
    Aug 2013
    Posts
    227
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Quote Originally Posted by nr1 View Post
    I won't do it with SharedPref, i will always use the Google-Play service on application startup to check which items were purchased and which not.
    Why?
    To me creating shared prefs just means some more code making everything more complex without having a real benefit (and shared prefs can also easily be hacked).
    What happens if the user starts your app without having an Internet connection?

  8. #18
    nr1
    nr1 is offline
    Member
    Join Date
    Feb 2013
    Posts
    51
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Quote Originally Posted by Skurry View Post
    What happens if the user starts your app without having an Internet connection?
    Shouldn't matter at all, see the 'Local Caching' documentation:
    In-app Billing Version 3 | Android Developers
    Because the Google Play client now caches In-app Billing information locally on the device, you can use the Version 3 API to query for this information more frequently, for example through a getPurchases call. Unlike with previous versions of the API, many Version 3 API calls will be serviced through cache lookups instead of through a network connection to Google Play, which significantly speeds up the API's response time.

  9. #19
    nr1
    nr1 is offline
    Member
    Join Date
    Feb 2013
    Posts
    51
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Little update to the In-App-Billing Manager classes:

    -Improved handling of invalid item consumption requests
    -Listener event names changed from 'doEvent' to 'onIabSetupFinished' / 'onConsumeFinished' / 'onPurchaseFinished'


    //edit: make sure to not use this version in production, it contains some bugs
    Attached Files Attached Files
    Last edited by nr1; 2014-01-31 at 04:48 PM.

  10. #20
    gcc
    gcc is offline
    Senior Member
    Join Date
    Aug 2013
    Posts
    1,322
    Post Thanks / Like
    Mentioned
    59 Post(s)
    I'm currently also working on an InAppBilling Manager class (based on the iab utils from google example).
    Goal is to make it really easy to implement the In-App stuff in your own apps.

    Will post it here for common work on it, when it's ready for being released as prototype.
    Added IAP successfully to remove ads.
    I store the flag in shared-prefs as user purchases "remove ads". I do not CONSUME the item and disable the "purchase" button.
    It works fine as long as user does not uninstall the App.

    Issue:-
    When user purchase,uninstall and install it again i want to query GP regarding the previous purchase without user knowledge and disable ads again and update the flag.
    I can check for Already_Owned code as 7 using launchPurchaseFlow(). but it launches the Google GUI to know the purchasing code.
    Is there any silent way to esquire the Already_Purchased situation??
    Last edited by gcc; 2014-01-07 at 04:14 PM.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 2013-12-01, 01:38 AM
  2. Replies: 2
    Last Post: 2013-10-19, 04:39 PM
  3. How to add interstitial ads in old admob?
    By jose in forum Advertising Networks
    Replies: 3
    Last Post: 2013-09-13, 05:19 AM
  4. In-app billing or sell a full version of the app?
    By MobileVisuals in forum Paid Apps
    Replies: 3
    Last Post: 2013-08-02, 12:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •