question

skodama avatar image
skodama asked skodama commented

ACTION_SECURE_PAY intent using startActivityForResult always fails and returns immediately

I'm trying to process a payment by following the answer in the following post:

How can I take a credit card payment on Clover Mini / Mobile?

However, after calling the startActivityForResult, I get the failure result immediately at onActivityResult.

It used to work a few weeks ago.

Am I missing something? Or did anything change at the Clover Secure Payment app?

The warning logs in ADB are as follows:

10-29 10:10:32.802: W/ActivityManager(862): Activity is launching as a new task, so cancelling activity result.
10-29 10:10:33.378: W/ActivityManager(862): Activity pause timeout for ActivityRecord{419bc1d0 u0 com.example.rabbitmqtest1android/.MainActivity t32}
10-29 10:10:33.507: W/WindowStateAnimator(862): current user violation 0 trying to display WindowStateAnimator{41f9a278 Starting com.clover.payment.executor.secure}, type 3, belonging to 1000
10-29 10:10:33.664: W/CardReaderTx(10598): open(CardReader.java:87): opening session ...

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Abrams avatar image
Jacob Abrams answered skodama commented

You don't see any error messages on screen? Can you capture logs when you are running your app using adb logcat -v time and paste in the output here, especially look out for a stack trace or anything that is a warning W/ or error E/ in the logs. Can you also paste in the code you are using? Here is some code that I just tried and it seemed to work okay:

Intent intent = new Intent(Intents.ACTION_SECURE_PAY);
intent.putExtra(Intents.EXTRA_AMOUNT, 234l);
startActivityForResult(intent, 2);

The amount needs to be a long. Also I have this in my AndroidManifest.xml

<uses-permission android:name="clover.permission.ACTION_PAY"/>

I couldn't see the whole logs from your comment since comments are so limited in length, you can edit your question and add the logs. I saw this message: "Activity is launching as a new task, so cancelling activity result" Are you using FLAG_ACTIVITY_NEW_TASKin your intent? If so you should not, take a look at: http://stackoverflow.com/questions/11...

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

skodama avatar image skodama commented ·

Thanks for the reply. I have used the same code as yours and also made sure that I had the appropriate permissions in the AndroidManifest.xml. However, the result is the same. To be more precisely, it happens as follows: 1. Call the intent and start waiting for the result at the main activity 2. The payment app is shown at the device, and the main activity immediately receives the failure result at onActivityResult (before doing anything at the payment app) I will post the log in the next comment.

0 Likes 0 ·
skodama avatar image skodama commented ·

Here are the Warning logs (there were no Error logs) 10-29 10:10:32.802: W/ActivityManager(862): Activity is launching as a new task, so cancelling activity result. 10-29 10:10:33.378: W/ActivityManager(862): Activity pause timeout for ActivityRecord{419bc1d0 u0 com.example.rabbitmq_test1_android/.MainActivity t32} 10-29 10:10:33.507: W/WindowStateAnimator(862): current user violation 0 trying to display WindowStateAnimator{41f9a278 Starting com.clover.payment.executor.secure}, type 3, belonging to 1000 10-29 10:10:33.664: W/CardReaderTx(10598): open(CardReader.java:87): opening session ...

0 Likes 0 ·
skodama avatar image
skodama answered

I investigated the cause of W/ActivityManager(862): Activity is launching as a new task, so cancelling activity result. and found out that the android:launchMode="singleInstance" was causing this behaviour.

Thanks for pointing me to the right direction.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community