Search Unity

callBackHandler never called

Discussion in 'Tizen' started by Wadjey, Feb 26, 2016.

  1. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    Hello,

    I'm testing the Unity Tizen IAP plugin, but I'm encountring a problem, after doing any request (GetAvailableItems, GetCountries... ) the app hangs on "Waiting for Plugin Callback" and the callBackHandler never called!

    To reproduce the issue, create a new project using the latest Unity version, import the Tizen IAP plugin from Asset Store, open the TizenSampleAppScene in the examples folder , build it and run it in your Tizen device.

    There is someone that can help me to make Unity Tizen IAP working?

    Thanks

    The source code of the scene:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using UnityEngine.UI;
    5. using System.Collections.Generic;
    6. using Tizen.IAP;
    7.  
    8. public class SampleClass
    9. {
    10. public int Value { get; set;}
    11.  
    12. public SampleClass(int x)
    13. {
    14. Value = x;
    15. }
    16. }
    17.  
    18. public class TizenSampleApp : MonoBehaviour {
    19.  
    20. string userMCC = null;
    21. string userMNC = null;
    22. string userGrpId = null;
    23. string userItemTypeCd = null;
    24. string userBuyItemName = null;
    25. public SampleClass userData = null;
    26.  
    27. //IAP object initialization
    28.  
    29. StoreProvider storeObj = StoreProvider.Instance;
    30. IAP_AppRequest appReq = new IAP_AppRequest ();
    31.  
    32.  
    33. void Start () {
    34. //valid data
    35. appReq.Mode = "1";
    36. appReq.StartNumber = 1;
    37. appReq.EndNumber = 200;
    38. appReq.StartDate = "2014-01-01";
    39. appReq.EndDate = "2020-12-31";
    40. appReq.ItemId = "000000581522";
    41. appReq.ItemName = "item1";
    42. appReq.ItemGroupId = "100000070614";
    43. appReq.LanguageCd = "ENG";
    44. appReq.ItemTypeCd = "10";
    45. appReq.Mcc = "404";
    46. appReq.Mnc = "01";
    47.  
    48. //calbackHandler
    49. appReq.RequestCallbackHandler = callBackHandler;
    50. userData = new SampleClass (12);
    51. appReq.RequestCallbackUserData = userData;
    52.  
    53.  
    54.  // ---> When GetAvailableItems (...) is called the app hangs on "Waiting for Plugin Callback" and the callBackHandler never called!
    55.  storeObj.GetAvailableItems(appReq);
    56.  }
    57.  
    58.  
    59. //CallBackHandler Definition
    60. public void callBackHandler(IAP_AppResponse response)
    61. {
    62. Debug.Log ("[ENTER CALLBACK ........... UNITY APP");
    63. if(response.ErrorCode == ErrorType.ERROR_ALL_SUCCESS)
    64. {
    65. if (response.RequestCode == RequestType.FUNC_GET_COUNTRY_LIST) {
    66. List<IAP_Country> countries = response.Countries;
    67. int i;
    68. for (i=0; i<countries.Count; i++) {
    69. Debug.LogError ("[UnityAppLOG]" + countries [i].Name);
    70. Debug.LogError ("[UnityAppLOG]" + countries [i].Mcc);
    71. }
    72. }
    73.  
    74. if (response.RequestCode == RequestType.FUNC_GET_ITEM_LIST) {
    75.  
    76. List<IAP_Item> AvailableItems = response.AvailableItems;
    77. int i;
    78. for(i = 0; i < AvailableItems.Count ; i++){
    79. Debug.LogError("[UnityAppLOG]" + AvailableItems [i].ItemName);
    80. }
    81. }
    82. if (response.RequestCode == RequestType.FUNC_GET_PURCHASED_ITEM_LIST) {
    83. List<IAP_Item> PurchasedItems = response.PurchasedItems;
    84. int i;
    85. for (i = 0; i < PurchasedItems.Count ; i++){
    86. Debug.LogError("[UnityAppLOG]" + PurchasedItems [i].ItemName);
    87. }
    88. }
    89.  
    90. if (response.RequestCode == RequestType.FUNC_PURCHASE) {
    91.  
    92. IAP_Purchase PurchaseOrder = response.PurchaseOrder;
    93. Debug.LogError("[UnityAppLOG]" + "Purchased Item is "+PurchaseOrder.ItemName);
    94. }
    95.  
    96. if (response.RequestCode == RequestType.FUNC_NONE) {
    97.  
    98. Debug.LogError("[UnityAppLOG]" + "No Request type came in Callback ");
    99. }
    100.  
    101. SampleClass receivedData = (SampleClass) response.UserData;
    102. Debug.LogError("User Data Value : " + receivedData.Value);
    103.  
    104. }
    105.  
    106. else Debug.Log("[UnityAppLOG]" + "response Error: "+ response.ErrorCode.ToString());
    107. }
    108. }
    109.  
    110.