question

seanzicari avatar image
seanzicari asked Jeffrey Blattman commented

Sanity check: Setting up a custom action intent

I'm looking to display a custom activity prior to starting an order (or maybe a textbox within a new order) using an action intent.

Firstly, am I on the right path?

If I include the ACTION_START_REGISTER intent filter and my app's main activity intent filter, is that enough to have Clover call my activity when the register app is opened? Does this sound correct?

I'm basing my understanding on the Actions and Intents documentation. What am I missing, if anything? I ask because I used the Clover intent filter (but not a main activity filter) in my app and, not only did nothing different happen when I opened the register, I have no idea how to tell that my custom intent was even attempted to be registered. Which leads me to my last question(s):

How can I debug my custom intent filter? Where do I gain visibility into what Clover is doing with my custom app?

Thank you for any and all help.
Intents
10 |2000

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

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered Jeffrey Blattman commented
If I include the ACTION_START_REGISTER intent filter and my app's main activity intent filter, is that enough to have Clover call my activity when the register app is opened? Does this sound correct?
No. That isn't an action that's sent when register is started, it's an action that's sent to start register. It's purpose is not to allow apps to intercept the starting of register and perform some action. If you had your filter correct, when an activity is started with that action, the result would be the system showing a chooser asking the user to select which activity to start: yours or the real register.

not only did nothing different happen when I opened the register, I have no idea how to tell that my custom intent was even attempted to be registered
If you start register from the launcher, it's going to start it via the component so it's not going to target your app even if you setup a filter to match ACTION_START_REGISTER . I realize that's not really what you want anyway but regardless. As you can imagine, it'd be bad if an app was able to intercept the starting of other apps and replace them. E.g., imagine if I wrote an app that intercepted start Gmail and faked asking you to enter your Gmail password.

How can I debug my custom intent filter? Where do I gain visibility into what Clover is doing with my custom app?
This is standard Android development here you'll find lots of resources online. Without knowing specifically what you are trying to find out it's hard to give any concrete answer.
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.

seanzicari avatar image seanzicari commented ·

@Jeffrey Blattman Thank you for the reply!

My goal is to:

allow your app to slot into the standard Clover payment flow

(quote taken from the Action Intents doc) I inferred from the Action Intents section of the documentation that there was maybe a way for my activity to be called prior to a built-in Clover activity (such as Register). I get your point about replacing a standard Clover activity and completely understand why I wouldn't want that to happen. I just want my activity called somewhere within the process. Is that possible?

I will "do my homework" regarding Android development - thank you for the info regarding visibility into my custom Clover app. I wasn't sure if Clover did anything non-standard that I'd need to be aware of, but based on your answer it seems the standard Android developer docs will answer all of my debugging questions.

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ seanzicari commented ·

There are many different types of intents with different meanings. There is no way to arbitrarily insert yourself in the payment flow at any point. The well-defined places you can do that are documented by ACTION_MODIFY_ORDER, ACTION_CUSTOMER_TENDER, and ACTION_MERCHANT_TENDER. These allow you to make modifications to the order and process a payment with a custom tender, respectively.

For the most part Clover development is Android development. There are some exceptions, but the handling of intents is not one of them.

0 Likes 0 ·

Welcome to the
Clover Developer Community