• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android IAP not working...

J

Jaime Lpz

Guest
Hi everyone,

I have been testing IAP for Android and cannot get them to work...

I have an object which controls IAP, it is actually the only object in the game as I created a new project just to test these out. I have created the IAP in the Google Play Deveoper Console, its ID is "ls_no_ads"

Create Event:
Code:
//Create IAP

var pNoAds = ds_map_create();
var productList = ds_list_create();
if (os_type == os_android){
   ds_map_add(pNoAds, "id", "ls_no_ads"); //ls_no_ads is the name of iap in play store


    ds_map_add(pNoAds, "title", "ls_no_ads"); //Remove Ads is the title of iap in play store
    //ds_map_add(pNoAds, "type", "Durable"); //Only for windows
    ds_map_add(pNoAds, "description", "Remove in game ads.");
    ds_map_add(pNoAds, "price", "$0.99");
    ds_list_add(productList, pNoAds);
    
    iap_activate(productList);
    ds_map_destroy(pNoAds);
    ds_list_destroy(productList);
    
}
Left Pressed Event:
Code:
if (iap_status() == iap_status_available){
       if (os_type == os_android){
          var product = "ls_no_ads";
          if (ds_map_find_value(global.purchaseMap, product) == 0){
            iap_acquire(product, "");
          }
       }
    } else{
        var status_label = "";
        switch (iap_status()) {
          case iap_status_uninitialised: status_label = "Uninitialized"; break;
          case iap_status_unavailable: status_label = "Unavailable"; break;
          case iap_status_loading: status_label = "Loading"; break;
          case iap_status_available: status_label = "Available"; break;
          case iap_status_processing: status_label = "Processing"; break;
          case iap_status_restoring: status_label = "Restoring"; break;
        }
        show_message_async(status_label);
      }
IAP asynchronous event:
Code:
var val = ds_map_find_value(iap_data, "type");
switch (val){
   case iap_ev_purchase:
      var map = ds_map_create();
      var purchase_id = ds_map_find_value(iap_data, "index");
      iap_purchase_details(purchase_id, map);
      if (ds_map_find_value(map, "status") == iap_purchased){
         var product_id = ds_map_find_value(map, "product");
         switch(product_id){
            case "ls_no_ads":
               ads_active = 0;
               GoogleMobileAds_RemoveBanner();
               break;
            }
      }
      ds_map_destroy(map);
      break;
   }
Whenever I press the button I get the "Loading" message which is returned from iap_status()...

The version I am working on is EA 1.99.505, I have tested in Gamemaker 1.4.1763 and get the same results.

I have added the com.android.vending.BILLING to the GooglePlayServicesExtension, as well as including my Google Play Public Key in the In App Purchases Tab.

This is driving me crazy, not really sure what may be the issue. If anyone has experienced something similar could you please help me out?

Thanks!
 
C

Columbo999

Guest
I'm getting the same issue... If anyone has any ideas that would be appreciated
 
Top