question

mybmr avatar image
mybmr asked finacussolutions answered

Facing issue of delay while opening auto-popup from our application.

Hello Folks,

We are facing an issue of delay while opening auto-popup from our application while we receive events for "V1_PAY_BUILD_START" from the Broadcast receiver. Our auto-popup displays after some sort of time in the payment screen while our merchant-facing device is connected to the customer-facing screen.


We want our auto-popup display as soon as the Clover payment screen displays on the merchant-facing devices. We have enabled a setting for "Automatically take payment on Connected Device" in our device in which we are taking payment through a connected customer-facing screen.


In this specific scenario, we are facing a delay in opening auto-popup. And we are opening auto-popup while we are receiving events for "V1_PAY_BUILD_START".


Can you please suggest how can we display auto-popup as soon as possible while we are opening the payment screen in our merchant-facing device and we are taking payment through customer-facing?


Here is the chunk of code we are using to open auto-popup from our application.

if (intent.getAction().equalsIgnoreCase("clover.intent.action.V1_PAY_BUILD_START")) {
            StringBuilder sb = new StringBuilder();
            sb.append("Action: " + intent.getAction() + "\n");
            sb.append("URI: " + intent.toUri(Intent.URI_INTENT_SCHEME).toString() + "\n");
            String log = sb.toString();
            Log.d(TAG, log);

            LogM.v("Action : " + intent.getAction());
            Pref.setValue(context, "changeAmount", "0.0");
            Pref.setValue(context, "lastDiscountAmount", "0.0");
            String aorderID = intent.getStringExtra(Intents.EXTRA_ORDER_ID);
            Log.d("mk", "Order ID 0=" + aorderID);
                try {
                    Intent in = new Intent(context, ChooserActivity.class)
                            .putExtra(Intents.EXTRA_ORDER_ID, aorderID)
                            .putExtra(Intents.EXTRA_AMOUNT, amt)
                            .putExtra("from", "1")
                            .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    context.startActivity(in);

                    Pref.setValueboolean(context, "already_open", true);
                } catch (Exception e) {

               }
} 


Is there anything we can improve over here?

Any help in this will be helpful.

Here, we are attaching an image of the setting we have applied to take payment on the customer-facing screen

imgonline-com-ua-compresstosize-2puvks78tzo.jpg


Regards,



Clover Android SDK
10 |2000

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

rosejlever avatar image
rosejlever answered rosejlever published

If you're experiencing delays when opening an auto-popup in your application, there could be several factors contributing to the issue. Here are a few possible causes and solutions you can consider:

  1. Performance Optimization: Evaluate the performance of your application and the auto-popup feature. Identify any potential bottlenecks, such as heavy computations, network requests, or inefficient code. Optimize the code and ensure that the auto-popup is implemented efficiently to minimize any delays.

  2. Network Latency: If the auto-popup involves fetching data from a remote server, network latency could be causing delays. Check the network connection and server response times to ensure they are within acceptable ranges. Consider implementing caching mechanisms or optimizing network requests to minimize delays.

  3. Device Compatibility: Different devices may have varying processing power and capabilities, which can impact the performance of your application and the auto-popup feature. Test the auto-popup on a range of devices to identify if the delays are device-specific. If so, optimize your code or adjust the implementation to improve performance across different devices.

  4. User Interface Design: Analyze the design and complexity of the auto-popup interface. If the interface contains numerous or large elements, such as images, videos, or complex animations, it can contribute to delays. Simplify the interface or optimize the loading and rendering of these elements to enhance the performance.

  5. Asynchronous Execution: Consider implementing asynchronous execution for tasks that might be causing delays. By offloading time-consuming operations to background threads or utilizing asynchronous programming techniques, you can ensure that the auto-popup opens quickly and doesn't block the main application's responsiveness.

10 |2000

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

herrylauu avatar image
herrylauu answered

If you're experiencing a delay when opening an auto-popup from your application, it can be caused by various factors, such as performance bottlenecks in the frontend or backend, inefficient event handling, or resource loading issues.

Sprunked

10 |2000

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

finacussolutions avatar image
finacussolutions answered

There are several factors that could contribute to the delay in opening the auto-popup. You can solve this problem by optimizing your code by removing any unnecessary processes or dependencies. Ensure that the popup loads asynchronously in order to prevent the user interface from being blocked. It is also necessary to identify and address issues affecting performance by using developer tools in order to identify and solve performance bottlenecks.

10 |2000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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