@ap-unity
Hello,
we now updated our project, the Unity version is 2017.1.p2 (the issue still persist). The IAP version is: Unity IAP v1.2.0. We use the same IAPScript on Google Daydream platform and there it works fine.We are not using codeless IAP, this is our code (mostly the same as official tutorial) and Debug log for IAP (filtered with adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG) :
Debug Log:
08-07 09:03:39.401 27173 27188 I Unity : Initializing Daydream controller API.
08-07 09:03:39.401 27173 27188 I Unity :
08-07 09:03:39.401 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:03:39.401 27173 27188 I Unity :
08-07 09:03:39.458 27173 27188 I Unity : Creating and initializing GVR API controller object.
08-07 09:03:39.458 27173 27188 I Unity :
08-07 09:03:39.458 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:03:39.458 27173 27188 I Unity :
08-07 09:03:39.459 27173 27188 I Unity : GVR API successfully initialized. Now resuming it.
08-07 09:03:39.459 27173 27188 I Unity :
08-07 09:03:39.459 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:03:39.459 27173 27188 I Unity :
08-07 09:03:39.459 27173 27188 I Unity : GVR API resumed.
08-07 09:03:39.459 27173 27188 I Unity :
08-07 09:03:39.459 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:03:39.459 27173 27188 I Unity :
08-07 09:03:39.612 3810 4851 I ActivityManager: Start proc 27372:com.osp.app.signin/u0a81 for content provider com.osp.app.signin/com.msc.openprovider.OpenContentProvider
08-07 09:03:39.658 3810 1848 I ActivityManager: DSS on for com.osp.app.signin and scale is 1.0
08-07 09:03:39.681 3810 4681 W ActivityManager: Permission Denial: Accessing service ComponentInfo{com.google.android.music/com.google.android.music.dial.DialMediaRouteProviderService} from pid=27286, uid=10077 that is not exported from uid 10132
08-07 09:03:42.904 3810 3824 I ActivityManager: Waited long enough for: ServiceRecord{6d7d8ed u0 com.samsung.android.oneconnect/.QcService}
08-07 09:03:48.923 3810 8541 I ActivityManager: KPU : put [com.sec.android.app.sbrowser] : 3700 K
08-07 09:03:48.923 3810 8541 I ActivityManager: Killing 26491:com.sec.android.app.sbrowser/u0a172 (adj 906): DHA:empty #33
08-07 09:03:48.925 3810 8541 I ActivityManager: KPU : put [com.samsung.android.themecenter] : 4548 K
08-07 09:03:48.925 3810 8541 I ActivityManager: Killing 26478:com.samsung.android.themecenter/1000 (adj 906): DHA:empty #33
08-07 09:03:48.926 3810 8541 I ActivityManager: KPU : put [com.samsung.android.scloud] : 4412 K
08-07 09:03:48.926 3810 8541 I ActivityManager: Killing 26455:com.samsung.android.scloud/5009 (adj 906): DHA:empty #33
08-07 09:03:48.927 3810 8541 I ActivityManager: KPU : put [com.samsung.android.app.mirrorlink] : 3712 K
08-07 09:03:48.927 3810 8541 I ActivityManager: Killing 26437:com.samsung.android.app.mirrorlink/1000 (adj 906): DHA:empty #33
08-07 09:03:49.060 3810 5231 D ActivityManager: cleanUpApplicationRecord – 26478
08-07 09:03:49.073 3810 5628 D ActivityManager: cleanUpApplicationRecord – 26491
08-07 09:03:49.096 3810 4681 D ActivityManager: cleanUpApplicationRecord – 26455
08-07 09:03:49.113 3810 4403 D ActivityManager: cleanUpApplicationRecord – 26437
08-07 09:03:59.171 3810 4879 I ActivityManager: KPU : put [com.sec.android.widgetapp.samsungapps] : 4092 K
08-07 09:03:59.171 3810 4879 I ActivityManager: Killing 26540:com.sec.android.widgetapp.samsungapps/u0a39 (adj 906): DHA:empty #33
08-07 09:03:59.200 3810 9212 D ActivityManager: cleanUpApplicationRecord – 26540
08-07 09:04:08.433 27173 27188 W Unity : Unavailable product system.muscles -system.muscles
08-07 09:04:08.433 27173 27188 W Unity :
08-07 09:04:08.433 27173 27188 W Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:04:08.433 27173 27188 W Unity :
08-07 09:04:08.433 27173 27188 W Unity : Unavailable product system.breathings -system.breathings
08-07 09:04:08.433 27173 27188 W Unity :
08-07 09:04:08.433 27173 27188 W Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:04:08.433 27173 27188 W Unity :
08-07 09:04:09.016 3810 5628 I ActivityManager: Killing 16643:com.sec.android.gallery3d/u0a47 (adj 906): empty for 1800s
08-07 09:04:09.058 3810 4413 D ActivityManager: cleanUpApplicationRecord – 16643
08-07 09:04:28.967 3810 5231 I ActivityManager: Process com.samsung.android.oneconnect:QcService (pid 27129) has died(154,624)
08-07 09:04:28.969 3810 5231 D ActivityManager: cleanUpApplicationRecord – 27129
08-07 09:04:30.476 27173 27188 I Unity : system.nerves: BuyNervy (UnityEngine.GameObject), ButtonNervy (UnityEngine.GameObject)
08-07 09:04:30.476 27173 27188 I Unity :
08-07 09:04:30.476 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:04:30.476 27173 27188 I Unity :
08-07 09:04:30.478 27173 27188 I Unity : Purchasing product asychronously: ‘system.nerves’
08-07 09:04:30.478 27173 27188 I Unity :
08-07 09:04:30.478 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:04:30.478 27173 27188 I Unity :
08-07 09:04:30.494 27173 27188 I Unity : purchase({0}): system.nerves
08-07 09:04:30.494 27173 27188 I Unity :
08-07 09:04:30.494 27173 27188 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
08-07 09:04:30.494 27173 27188 I Unity :
--------- beginning of crash
08-07 09:04:30.586 3810 24876 W ActivityManager: Force finishing activity com.virtualmedicine.humanatomyvrcardboard/com.unity3d.player.UnityPlayerActivity
08-07 09:04:30.614 3810 24876 D ActivityManager: moveToFront() : reason=finishActivity adjustFocus setFocusedActivity isAttached=true TaskRecord{c1cc5b5d0 #1761 A=com.sec.android.app.launcher U=0 StackId=0 sz=1}
08-07 09:04:30.618 3810 24876 D ActivityManager: setFocusStackUnchecked: reason=finishActivity adjustFocus setFocusedActivity focusCandidate=ActivityStack{425f31fd0 stackId=0, 2 tasks} caller=com.android.server.am.ActivityStack.moveToFront:873 com.android.server.am.ActivityStackSupervisor.moveActivityStackToFront:1995
08-07 09:04:31.134 3810 3824 W ActivityManager: Activity pause timeout for ActivityRecord{606baadd0 u0 com.virtualmedicine.humanatomyvrcardboard/com.unity3d.player.UnityPlayerActivity t1949 f}
08-07 09:04:31.137 3810 3824 D ActivityManager: resumeTopActivityInnerLocked() : #0 prevTask=TaskRecord{98154a9d0 #1949 A=com.virtualmedicine.humanatomyvrcardboard U=0 StackId=1 sz=1} next=ActivityRecord{8c8f2f9d0 u0 com.sec.android.app.launcher/.activities.LauncherActivity t1761} mFocusedStack=ActivityStack{425f31fd0 stackId=0, 2 tasks}
08-07 09:04:31.140 3810 3824 D ActivityManager: mActivityResumeBooster.acquire()
08-07 09:04:31.227 3810 3824 I ActivityManager: Config changes=480 {0 1.0 themeSeq = 0 showBtnBg = 0 ?mcc?mnc [sk_SK] ldltr sw360dp w360dp h616dp 640dpi nrml long port finger -keyb/v/h -nav/h mkbd/h s.93}
08-07 09:04:31.519 3810 4860 W ActivityManager: Slow operation: 65ms so far, now at getContentProviderImpl: after updateOomAdj
08-07 09:04:31.519 3810 4860 W ActivityManager: Slow operation: 65ms so far, now at getContentProviderImpl: done!
08-07 09:04:31.523 3810 3824 I ActivityManager: Waited long enough for: ServiceRecord{c64c359 u0 com.google.android.music/com.google.android.wearable.datatransfer.DataSyncService}
08-07 09:04:31.523 3810 3824 I ActivityManager: Waited long enough for: ServiceRecord{705bfff u0 com.samsung.android.fmm/com.sec.dsm.system.task.location.DSMLastLocation}
08-07 09:04:31.639 3810 3824 D ActivityManager: mActivityResumeBooster.release()
08-07 09:04:31.639 3810 3824 D ActivityManager: mActivityResumeBoosterTail.acquire()
08-07 09:04:31.868 3810 13211 D ActivityManager: post active user change for 0 fullscreen true isHomeActivity() true
08-07 09:04:32.291 3810 9212 D PackageManager: getComponentMetadataForIconTray : com.google.vr.inputcompanion.MainActivity does not exist in mServices
08-07 09:04:32.291 3810 9212 D PackageManager: getComponentMetadataForIconTray : com.google.vr.inputcompanion.MainActivity does not exist in mProviders
08-07 09:04:32.291 3810 9212 D PackageManager: getComponentMetadataForIconTray : com.google.vr.inputcompanion.MainActivity does not exist in mReceivers
08-07 09:04:34.974 3810 4880 I ActivityManager: KPU : put [com.wssnps] : 3800 K
08-07 09:04:34.974 3810 4880 I ActivityManager: Killing 26580:com.wssnps/1000 (adj 906): DHA:empty #29
08-07 09:04:34.975 3810 4880 I ActivityManager: KPU : put [com.sec.android.service.health] : 1516 K
08-07 09:04:34.975 3810 4880 I ActivityManager: Killing 26559:com.sec.android.service.health/u0a21 (adj 906): DHA:empty #29
08-07 09:04:35.049 3810 13211 I ActivityManager: KPU : remove [com.wssnps] , Remain = 1516 K
08-07 09:04:35.049 3810 13211 D ActivityManager: cleanUpApplicationRecord – 26580
08-07 09:04:35.059 3810 1848 D ActivityManager: cleanUpApplicationRecord – 26559
08-07 09:04:36.430 3810 1848 I ActivityManager: KPU : put [com.oculus.horizon] : 6956 K
08-07 09:04:36.431 3810 1848 I ActivityManager: Killing 26631:com.oculus.horizon/u0a186 (adj 906): DHA:empty #27
08-07 09:04:36.432 3810 1848 I ActivityManager: KPU : put [com.oculus.home] : 1536 K
08-07 09:04:36.432 3810 1848 I ActivityManager: Killing 26595:com.oculus.home/u0a186 (adj 906): DHA:empty #27
08-07 09:04:36.504 3810 4413 I ActivityManager: KPU : remove [com.oculus.horizon] , Remain = 1536 K
08-07 09:04:36.504 3810 4413 D ActivityManager: cleanUpApplicationRecord – 26631
08-07 09:04:36.508 3810 4413 I ActivityManager: KPU : put [com.samsung.android.app.watchmanager:contentprovider] : 3756 K
08-07 09:04:36.508 3810 4413 I ActivityManager: Killing 26686:com.samsung.android.app.watchmanager:contentprovider/u0a13 (adj 906): DHA:empty #25
08-07 09:04:36.510 3810 4413 I ActivityManager: KPU : put [com.sec.android.app.shealth] : 3892 K
08-07 09:04:36.510 3810 4413 I ActivityManager: Killing 26527:com.sec.android.app.shealth/u0a83 (adj 906): DHA:empty #25
08-07 09:04:36.581 3810 3606 I ActivityManager: KPU : remove [com.sec.android.app.shealth] , Remain = 5292 K
08-07 09:04:36.581 3810 3606 D ActivityManager: cleanUpApplicationRecord – 26527
08-07 09:04:36.584 3810 3606 I ActivityManager: KPU : put [com.sec.android.app.shealth:remote] : 3904 K
08-07 09:04:36.584 3810 3606 I ActivityManager: Killing 26509:com.sec.android.app.shealth:remote/u0a83 (adj 906): DHA:empty #23
08-07 09:04:36.586 3810 3606 I ActivityManager: KPU : put [com.facebook.appmanager] : 1528 K
08-07 09:04:36.586 3810 3606 I ActivityManager: Killing 24534:com.facebook.appmanager/u0a109 (adj 906): DHA:empty #23
08-07 09:04:36.608 3810 5231 I ActivityManager: KPU : remove [com.oculus.home] , Remain = 9188 K
08-07 09:04:36.608 3810 5231 D ActivityManager: cleanUpApplicationRecord – 26595
08-07 09:04:36.613 3810 5231 I ActivityManager: KPU : put [com.oculus.vrshell.home] : 1496 K
08-07 09:04:36.613 3810 5231 I ActivityManager: Killing 26816:com.oculus.vrshell.home/u0a192 (adj 906): DHA:empty #21
08-07 09:04:36.614 3810 5231 I ActivityManager: KPU : put [com.google.android.gms.unstable] : 3928 K
08-07 09:04:36.614 3810 5231 I ActivityManager: Killing 25006:com.google.android.gms.unstable/u0a14 (adj 906): DHA:empty #21
08-07 09:04:36.680 3810 6835 I ActivityManager: KPU : remove [com.oculus.vrshell.home] , Remain = 13116 K
08-07 09:04:36.680 3810 6835 D ActivityManager: cleanUpApplicationRecord – 26816
08-07 09:04:36.700 3810 26182 I ActivityManager: KPU : remove [com.sec.android.app.shealth:remote] , Remain = 9212 K
08-07 09:04:36.700 3810 26182 D ActivityManager: cleanUpApplicationRecord – 26509
08-07 09:04:36.903 3810 4413 I ActivityManager: KPU : remove [com.google.android.gms.unstable] , Remain = 5284 K
08-07 09:04:36.904 3810 4413 D ActivityManager: cleanUpApplicationRecord – 25006
08-07 09:04:36.940 3810 20520 I ActivityManager: KPU : remove [com.facebook.appmanager] , Remain = 3756 K
08-07 09:04:36.943 3810 20520 D ActivityManager: cleanUpApplicationRecord – 24534
08-07 09:04:36.972 3810 5626 I ActivityManager: KPU : remove [com.samsung.android.app.watchmanager:contentprovider] , Remain = 0 K
08-07 09:04:36.972 3810 5626 D ActivityManager: cleanUpApplicationRecord – 26686
08-07 09:04:42.507 3810 24876 W ActivityManager: Force finishing activity com.virtualmedicine.humanatomyvrcardboard/com.unity3d.player.UnityPlayerActivity
08-07 09:04:42.573 3810 24876 I ActivityManager: Killing 27173:com.virtualmedicine.humanatomyvrcardboard/u0a221 (adj 900): crash
08-07 09:04:42.573 3810 24876 D ActivityManager: cleanUpApplicationRecord – 27173
08-07 09:04:47.874 3810 20520 I ActivityManager: Start proc 27571:com.samsung.android.MtpApplication/1000 for broadcast com.samsung.android.MtpApplication/.MtpReceiver
08-07 09:04:47.981 3810 4681 I ActivityManager: DSS on for com.samsung.android.MtpApplication and scale is 1.0
08-07 09:04:48.226 3810 8684 I ActivityManager: Start proc 27588:com.wssnps/1000 for broadcast com.wssnps/.smlNpsReceiver
08-07 09:04:48.265 3810 4861 I ActivityManager: DSS on for com.wssnps and scale is 1.0
08-07 09:04:48.383 3810 4659 I ActivityManager: Start proc 27601:com.sec.android.easyMover/u0a180 for broadcast com.sec.android.easyMover/.Receiver
08-07 09:04:48.479 3810 8544 I ActivityManager: DSS on for com.sec.android.easyMover and scale is 1.0
08-07 09:04:49.735 3810 3840 I ActivityManager: Start proc 27622:com.android.defcontainer/u0a6 for service com.android.defcontainer/.DefaultContainerService
08-07 09:04:49.770 3810 4880 I ActivityManager: DSS on for com.android.defcontainer and scale is 1.0
08-07 09:04:49.860 3810 4167 I ActivityManager: Start proc 27638:com.wssyncmldm/1000 for service com.wssyncmldm/com.samsung.android.app.fotaclient.device.PollingIntentService
08-07 09:04:49.895 3810 24876 I ActivityManager: DSS on for com.wssyncmldm and scale is 1.0
08-07 09:04:51.192 3810 5231 I ActivityManager: Process com.sec.android.easyMover (pid 27601) has died(1147,571)
08-07 09:04:51.192 3810 5231 D ActivityManager: cleanUpApplicationRecord – 27601
08-07 09:04:52.745 3810 8544 I ActivityManager: Start proc 27669:com.samsung.android.oneconnect:QcService/u0a162 for service com.samsung.android.oneconnect/.QcService
08-07 09:04:52.790 3810 5230 I ActivityManager: DSS on for com.samsung.android.oneconnect and scale is 1.0
08-07 09:05:03.199 3810 3834 W ActivityManager: Unable to start service Intent { cmp=com.samsung.android.mateagent/.interact.AgentService launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } } U=0: not found
08-07 09:05:04.897 3810 3824 I ActivityManager: Waited long enough for: ServiceRecord{8436777 u0 com.samsung.android.MtpApplication/.MtpService}
08-07 09:05:07.747 3810 3824 I ActivityManager: Waited long enough for: ServiceRecord{48e53ba u0 com.samsung.android.oneconnect/.QcService}
08-07 09:05:09.275 3810 26182 I ActivityManager: Start proc 27734:com.samsung.cmh:CMH/5004 for service com.samsung.cmh/.service.CMHService
08-07 09:05:09.326 3810 3821 I ActivityManager: DSS on for com.samsung.cmh and scale is 1.0
08-07 09:05:09.680 3810 3820 I ActivityManager: Start proc 27762:com.samsung.enhanceservice/5004 for service com.samsung.enhanceservice/.EnhanceService
08-07 09:05:09.713 3810 18345 I ActivityManager: Start proc 27775:com.samsung.dcmservice/5004 for service com.samsung.dcmservice/.DCMService
08-07 09:05:09.732 3810 9212 I ActivityManager: DSS on for com.samsung.enhanceservice and scale is 1.0
08-07 09:05:09.780 3810 9211 I ActivityManager: DSS on for com.samsung.dcmservice and scale is 1.0
08-07 09:05:41.143 3810 5628 I ActivityManager: Process com.samsung.android.MtpApplication (pid 27571) has died(966,694)
08-07 09:05:41.143 3810 5628 D ActivityManager: cleanUpApplicationRecord – 27571
08-07 09:05:41.274 3810 4413 I ActivityManager: Start proc 27836:com.samsung.android.MtpApplication/1000 for broadcast com.samsung.android.MtpApplication/.MtpReceiver
08-07 09:05:41.320 3810 24876 I ActivityManager: DSS on for com.samsung.android.MtpApplication and scale is 1.0
08-07 09:05:41.520 3810 4880 I ActivityManager: Start proc 27857:com.sec.android.easyMover/u0a180 for broadcast com.sec.android.easyMover/.Receiver
08-07 09:05:41.576 3810 5626 I ActivityManager: DSS on for com.sec.android.easyMover and scale is 1.0
08-07 09:05:43.773 3810 4861 I ActivityManager: Process com.sec.android.easyMover (pid 27857) has died(950,700)
08-07 09:05:43.773 3810 4861 D ActivityManager: cleanUpApplicationRecord – 27857
08-07 09:05:53.730 3810 3821 I ActivityManager: Process com.samsung.android.oneconnect:QcService (pid 27669) has died(950,709)
08-07 09:05:53.730 3810 3821 D ActivityManager: cleanUpApplicationRecord – 27669
08-07 09:05:57.507 3810 3824 I ActivityManager: Waited long enough for: ServiceRecord{6ef5c9f u0 com.samsung.android.MtpApplication/.MtpService}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Purchasing;
using UnityEngine.UI;
// Deriving the Purchaser class from IStoreListener enables it to receive messages from Unity Purchasing.
namespace Scripty.IAPPurchase {
public class IAPScript : MonoBehaviour, IStoreListener {
private ProductCatalog catalog;
private static IStoreController controller; // The Unity Purchasing system.
private static IExtensionProvider extensions; // The store-specific Purchasing subsystems.
void Awake() {
if (controller == null) {
InitializePurchasing();
}
if (IsInitialized()) {
//getBoughtSystems();
}
}
public void InitializePurchasing() {
if (IsInitialized()) {
return;
}
catalog = ProductCatalog.LoadDefaultCatalog();
StandardPurchasingModule module = StandardPurchasingModule.Instance();
//module.useFakeStoreUIMode = FakeStoreUIMode.DeveloperUser;
ConfigurationBuilder builder = ConfigurationBuilder.Instance(module);
foreach (var product in catalog.allProducts) {
if (product.allStoreIDs.Count > 0) {
var ids = new IDs();
foreach (var storeID in product.allStoreIDs) {
ids.Add(storeID.id, storeID.store);
}
builder.AddProduct(product.id, product.type, ids);
}
else {
builder.AddProduct(product.id, product.type);
}
}
UnityPurchasing.Initialize(this, builder);
}
private bool IsInitialized() {
// Only say we are initialized if both the Purchasing references are set.
return controller != null && extensions != null;
}
public void BuyFeature(string sku) {
BuyProductID(sku);
}
void BuyProductID(string productId) { //GameObject buyObject, Button feature
if (IsInitialized()) {
Product product = controller.products.WithID(productId);
if (product != null && product.availableToPurchase) {
Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
controller.InitiatePurchase(product);
}
else {
Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
}
}
else {
Debug.Log("BuyProductID FAIL. Not initialized.");
}
}
public Product GetProduct(string productId) {
if (IsInitialized()) {
return controller.products.WithID(productId);
}
Debug.Log("Not initialized.");
return null;
}
public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {
//Debug.Log("OnInitialized: PASS. "+ controller.products.all.Length + " items to buy.");
IAPScript.controller = controller;
IAPScript.extensions = extensions;
}
public void OnInitializeFailed(InitializationFailureReason error) {
// Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
}
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) {
Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
return PurchaseProcessingResult.Complete;
}
public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) {
Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}",
product.definition.storeSpecificId, failureReason));
}
}
}