Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[SOLVED] Cannot Initialize ILoginListener

Discussion in 'Xiaomi' started by seec1, Feb 6, 2018.

  1. seec1

    seec1

    Joined:
    Jun 6, 2016
    Posts:
    11
    Dear,
    I have a crash bug when I tried to Initialize ILoginListener.
    I just do with your sample code:

    Code (CSharp):
    1. void Awake()
    2. {
    3. MyLoginListener loginListener = new MyLoginListener();
    4. loginListener.initializeIAP = ConfigureIAP;
    5. AppStoreSettings appStoreSettings = Resources.Load<AppStoreSettings>("AppStoreSettings");
    6. UnityEngine.Store.StoreService.Initialize(appStoreSettings.getAppInfo(), loginListener);
    7. }
    I debugged, when StoreService.Initialize called -> debug log print :
    Code (CSharp):
    1. 02-06 13:42:48.691 I  [ChannelHandler]init called begin
    2. 02-06 13:42:48.691 I  [XiaomiProviderService]xiaomi Init begin
    After that, game will be crash.
    Any idea?
    I using: Unity 2017.1.3f1, UnityPurchasing version: 1.15.0 (I think it's newest version)
    Thanks and best regard,

    This is MyLoginListener class
    Code (CSharp):
    1. public class MyLoginListener : ILoginListener
    2. {
    3.     public Action initializeIAP;
    4.  
    5.     public void OnLogin(UserInfo userInfo)
    6.     {
    7.         Debug.Log(string.Format("Login Succeed: userId {0}, userLoginToken {1}, channel {2}",
    8.             userInfo.userId, userInfo.userLoginToken, userInfo.channel));
    9.         // When login succeeds, proceed to initializing IAP
    10.         initializeIAP();
    11.     }
    12.     public void OnInitialized()
    13.     {
    14.         Debug.Log("Initialize Succeed");
    15.         UnityEngine.Store.StoreService.Login(this);
    16.     }
    17.     public void OnInitializeFailed(string message)
    18.     {
    19.         Debug.Log("Initialize Failed " + message);
    20.     }
    21.     public void OnLoginFailed(string message)
    22.     {
    23.         Debug.Log("Login Failed: " + message);
    24.     }
    25. }
    It was not going to line any line in this class.
     
    Last edited: Feb 6, 2018
  2. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
  3. seec1

    seec1

    Joined:
    Jun 6, 2016
    Posts:
    11
    Hi @unityjingyao
    Code (CSharp):
    1.  
    2.  
    3. 02-06 13:42:46.421 W  UnityPlayerNativeActivity has been deprecated, please update your AndroidManifest to use UnityPlayerActivity instead
    4. 02-06 13:42:46.442 W  Failed to get permission info for com.xiaomi.sdk.permission.PAYMENT, manifest likely missing custom permission declaration
    5. 02-06 13:42:46.443 W  Permission com.xiaomi.sdk.permission.PAYMENT ignored
    6. 02-06 13:42:46.444 W  Failed to get permission info for com.xiaomi.permission.AUTH_SERVICE, manifest likely missing custom permission declaration
    7. 02-06 13:42:46.444 W  Permission com.xiaomi.permission.AUTH_SERVICE ignored
    8. 02-06 13:42:46.484 I  onResume
    9. 02-06 13:42:46.622 I  windowFocusChanged: true
    10. 02-06 13:42:46.690 I  SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 8, Memory = 1791mb
    11. 02-06 13:42:46.691 I  SystemInfo ARM big.LITTLE configuration: 4 big (mask: 240), 4 little (mask: 15)
    12. 02-06 13:42:46.691 I  ApplicationInfo kangokuboyTc.mi version 1.0.0 build 2978e7a6-fd6c-44d6-a3fa-57cdb53c5679
    13. 02-06 13:42:46.952 I  Default GameObject Tag: SocialManager already registered
    14. 02-06 13:42:48.670 I  --- clientId : zkvnjtzB1KVmrYOEIKRdFg ---
    15. 02-06 13:42:48.670 I  UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    16. 02-06 13:42:48.670 I  UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    17. 02-06 13:42:48.670 I  UnityEngine.Logger:Log(LogType, Object)
    18. 02-06 13:42:48.670 I  UnityEngine.Debug:Log(Object)
    19. 02-06 13:42:48.670 I  TitleManager:Awake() (at /Users/vuha/Documents/Dev/Github-2/tokyo.seec.kangokuboyCNxsolla/Assets/_Script/Manager/TitleManager.cs:41)
    20. 02-06 13:42:48.691 I  [ChannelHandler]init called begin
    21. 02-06 13:42:48.691 I  [XiaomiProviderService]xiaomi Init begin
    I don't know it's right thing you want. If not right i will send to you apk file via support ticket...
    Thanks...
     
  4. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @seec1 ,
    There is no crash log. Please send the apk file via support ticket. Thank you.
     
  5. seec1

    seec1

    Joined:
    Jun 6, 2016
    Posts:
    11
    This bug just appear on non-Xiaomi devices.
    Workaround for pass this bug.
    Input a fake string in App ID, App Key of AppStoreSettings. App ID and App Key can be any value in debug mode.



    Thanks for your supported Jingyao...