Search Unity

ThreadAbortException after called startIntentSenderForResult

Discussion in 'Android' started by auycro.heroz, Dec 11, 2015.

  1. auycro.heroz

    auycro.heroz

    Joined:
    Apr 1, 2015
    Posts:
    13
    Hi everyone,

    Now I try to make the purchase method in Android.

    When startIntentSenderForResult is called, ThreadAbortException is shown in "adb logcat".
    Then there is no response for onActivityResult().

    Could you please suggest me how to solve this??

    Thank you in advance.

    Code (CSharp):
    1.     public void Purchase(String productID, Activity activity, boolean subscribe) {
    2.                 try {
    3.                     Log.d(tag, "purchase " + productID);
    4.  
    5.                     String purchaseType = "inapp";
    6.                     int requestCode = 1001;
    7.                     if (subscribe) {
    8.                         purchaseType = "subs";
    9.                         requestCode = 2001;
    10.                     }
    11.  
    12.                     Bundle buy_intent_bundle = mService.getBuyIntent(3, activity.getPackageName(), productID, purchaseType, "developerPayload");
    13.                     Integer responseCode = buy_intent_bundle.getInt("RESPONSE_CODE");
    14.  
    15.                     if (responseCode == BILLING_RESPONSE_RESULT_OK) {
    16.                         PendingIntent pending_intent = buy_intent_bundle.getParcelable("BUY_INTENT");
    17.                         activity.startIntentSenderForResult(
    18.                                 pending_intent.getIntentSender(), requestCode, new Intent(),
    19.                                 Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
    20.                     } else {
    21.                         SendMessageToUnity(responseCode);
    22.                     }
    23.                 } catch (Exception e){
    24.                     Log.d(tag, "purchase failed" + productID + ":" + e.getMessage());
    25.                 }
    26.     }
    Code (CSharp):
    1. I/Unity   ( 9819): FailConnect 1 times -10182 System.IO.IOException: Read failure ---> System.Threading.ThreadAbortException: Thread was being aborted
    2. I/Unity   ( 9819):   at (wrapper managed-to-native) System.Net.Sockets.Socket:Receive_internal (intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)
    3. I/Unity   ( 9819):   at System.Net.Sockets.Socket.Receive_nochecks (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags, System.Net.Sockets.SocketError& error) [0x00000] in <filename unknown>:0
    4. I/Unity   ( 9819):   at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x00000] in <filename unknown>:0
    5. I/Unity   ( 9819):   at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
    6. I/Unity   ( 9819):   --- End of inner exception stack trace ---
    7. I/Unity   ( 9819):   at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
    8. I/Unity   ( 9819):   at System.IO.StreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
    9. I/Unity   ( 9819):   at System.IO.StreamReader.ReadLine () [0x00000]
    10. D/sensors_hal_SMGR(  989): SMGRReportDelete: Rcvd success response from request
    11. I/Unity   ( 9819): thread Abort Exception
    12. I/Unity   ( 9819):
    13. I/Unity   ( 9819): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 56)
    14. I/Unity   ( 9819):
     
  2. puppetisto

    puppetisto

    Joined:
    Jun 21, 2020
    Posts:
    14
    I'm getting a similar issue did you ever figure out how to resolve this?