Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by NimbleAi · Jul 15, 2016 at 01:47 PM · iapexceptionreceiver

IAP generates exception when calling m_StoreController.InitiatePurchase(product)

Hello,

I got an exception when calling m_StoreController.InitiatePurchase(product).

Following the Unity IAP demo, here is a fragment of my implementation of IAP:

public void buyProduct(IapType iapToBuy) {
Debug.Log("Entering buyProduct with iapToBuy: "+iapToBuy);
string productID=getIAPstringID(iapToBuy);
  if (isInitialized()) {
  Debug.Log("searching WithID:"+productID);
  Product product = m_StoreController.products.WithID(productID);
  Debug.Log("Product is available for purchase:"+product.availableToPurchase);
   if ((product!=null) && product.availableToPurchase) {
   Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
   m_StoreController.InitiatePurchase(product);
   }
...
}
Here is overridden OnApplicationPause() :

void OnApplicationPause(bool status) {
print("App paused called with status: "+status); //debug only
}
And here is my log with the unwanted exception that appears once the Unity tries to suspend my app and just before Android purchasing dialog appears:

I/Unity (23779): Entering buyProduct with iapToBuy: iapLeverDown
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): searching WithID:carshift_lever_down
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): Product is available for purchase:True
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): Purchasing product asychronously: 'carshift_lever_down'
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): purchase({0}): carshift_lever_down
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): handlePurchases state:psPurchasingInProgress
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): handlePurchases state:psPurchasingInProgress
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779): AndroidJavaException: java.lang.IllegalArgumentException: Receiver not registered: com.unity.purchasing.googleplay.GooglePlayPurchasing$3@2edbae3a
I/Unity (23779): java.lang.IllegalArgumentException: Receiver not registered: com.unity.purchasing.googleplay.GooglePlayPurchasing$3@2edbae3a
I/Unity (23779): at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:863)
I/Unity (23779): at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:2087)
I/Unity (23779): at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:529)
I/Unity (23779): at com.unity.purchasing.googleplay.GooglePlayPurchasing.OnApplicationPause(GooglePlayPurchasing.java:102)
I/Unity (23779): at com.unity3d.player.UnityPlayer.nativePause(Native Method)
I/Unity (23779): at com.unity3d.player.UnityPlayer.i(Unknown Source)
I/Unity (23779): at com.unity3d.player.UnityPlayer$18.run(Unknown Source)
I/Unity (23779): at com.unity3d.player.UnityPlayer.executeGLThreadJobs(Unknown Source)
I/Unity (23779): at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
I/Unity (23779): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0
I/Unity (23779): at UnityEngine.AndroidJNISafe.CallVo
I/Unity (23779): App paused called with status: True
I/Unity (23779):
I/Unity (23779): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
I/Unity (23779):

All 4 basic IStoreListener listeners:
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
public void OnInitializeFailed(InitializationFailureReason error)
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)

are implemented according to the IAP demo.

Purchaser is attached to only one object, init is called once only and the object is not destroyed between scenes. Exception appears only during the first call the method after app init. Purchase can be cancelled as well as completed and all subsequent events are delivered to the corresponding listeners.
One can say that the exception can be only ignored but the question is whether it does not signalize something more serious that would appear only in production.

Presumably, Unity tries to unregister receiver just before calling google's purchasing function but the receiver (which one?) is not registered..

Any thoughts, please?

Thank you,
Paul

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image NimbleAi · Jul 15, 2016 at 03:25 PM 0
Share

Update: it has nothing to do with InitiatePurchase() function but rather with pausing the App. The same occurs when (after successful initialisation of the Purchaser) I click device HW left button (aka task manager) and the device offers to close app(s)... And again, only after the first call.

avatar image NimbleAi · Jul 15, 2016 at 03:36 PM 0
Share

Linked to this: http://forum.unity3d.com/threads/exception-on-unityiap-android-when-moving-to-1-6.416144/

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

TypeLoadException Error with Unity IAP,TypeLoadException Error when implementing Unity IAP 0 Answers

How do I catch the SendMessage Has No Reciever exception thrown when I try to run a function with SendMessage that does not exist? 1 Answer

Samsung Galaxy Apps IAP 3 error 0 Answers

ProcessPurchase not called on startup (Android) 2 Answers

unity iap: ios transactionid can not find 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges