Search Unity

[Closed] Unity IAP Custom Store for Android

Discussion in 'Unity IAP' started by incytel, May 20, 2017.

Thread Status:
Not open for further replies.
  1. incytel

    incytel

    Joined:
    Mar 2, 2016
    Posts:
    3
    Greetings,

    I have implemented my own store for Android according to this, (though the module part is very vaguely explained). My problem is that I want to target MyStore, like "Unity IAP/Android/Target Amazon" menu item, but there is no such thing in the menu, it only has the pre-defined stores, and when I target my store manually using "UnityEngine.Purchasing.UnityPurchasingEditor.TargetAndroidStore(UnityEngine.Purchasing.AndroidStore.NotSpecified)", in the build time unity tries to include all the class libraries and related AndroidManifest entries (Amazon, Google Play, ...) in my export! I don't want to include all of the libraries I don't need and all the permissions I don't want in my build.

    My question:
    1.How can I properly add my store to the list so that I can target it individually without including everything?
    2.(if 1 not possible) How can I just do something like TargetAndroidStore(AndroidStore.Nothing) so that I can include my own libraries manually.
    3.(if 1 and 2 are not possible) Since I am using Unity IAP for iOS AppStore, how do I disable UnityIAP completely ONLY for Android so that I can use my alternative android solution?

    Regards
     
  2. incytel

    incytel

    Joined:
    Mar 2, 2016
    Posts:
    3
    A not-so-clean workaround:

    Code (CSharp):
    1. [MenuItem("Window/Unity IAP/Android/No Target")]
    2.     public static void UnityIAPNoTarget()
    3.     {
    4.         string root = "Assets/Plugins/UnityPurchasing/Bin/Android/";
    5.         string[] libs = {
    6.                             "AmazonAppStore.aar",
    7.                             "CloudMoolah.aar",
    8.                             "common.aar",
    9.                             "GoogleAIDL.aar",
    10.                             "GooglePlay.aar",
    11.                             "SamsungApps.aar",
    12.                         };
    13.         foreach (var lib in libs)
    14.         {
    15.             var path = root + lib;
    16.             PluginImporter pi = PluginImporter.GetAtPath(path) as PluginImporter;
    17.             pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
    18.         }
    19.     }
    20.  
    21.     [PostProcessScene(100)]
    22.     static void OnPostProcessScene()
    23.     {
    24.         Debug.Log("Disabling UnityIAP libs");
    25.         UnityIAPNoTarget();  
    26.     }
    It would be great if Unity adds this option or at least makes Stores.dll and Editor.dll for IAP open-source so we can fix it ourselves.
     
Thread Status:
Not open for further replies.