question

demskigroup avatar image
demskigroup asked mikebrooking answered

Customer Facing Activity Not Showing

We have an activity that we are trying to trigger as a customer facing activity but its not working.

Here's the code in our activity that calls the customer facing activity:

public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    remoteDeviceConnector = new RemoteDeviceConnector(this, CloverCount.getAccount(this));
}

@Override
    public void onPause()
    {
        //super.onPause();
        //finish();

        super.onPause();
        executor.execute(()->{
            remoteDeviceConnector.sendMessageToActivity(new MessageToActivity(CUSTOM_ACTIVITY_NAME, "FINISH"));
            remoteDeviceConnector.disconnect();
        });
    }

public void onResume()
    {
        super.onResume();
        final String payload = "{\"msg\"=\"Initial...\"}"; // if you need an inital payload
        final CustomActivityRequest car = new CustomActivityRequest(CUSTOM_ACTIVITY_NAME, payload);
        executor.execute(()->{
            remoteDeviceConnector.resetDevice(new ResetDeviceRequest());
            remoteDeviceConnector.startCustomActivity(car, new CustomActivityListener(){
                @Override public void onMessageFromActivity(MessageFromActivity message) {
                    // handle message from the CustomActivity
                }

                @Override public void onCustomActivityResult(CustomActivityResponse response) {
                    // handle the result of the CustomActivity
                }
            });
        });
    }

and here's the manifest:

<activity android:name=".SaleDialogActivityCF" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
            <intent-filter>
                <action android:name="com.yourdomain.ACTIVITY_NAME"/>
                <category android:name="com.clover.cfp.ACTIVITY"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

and lastly the activity that's called:

private static final String CUSTOM_ACTIVITY_NAME = ".SaleDialogActivityCF";
Clover Mini
10 |2000

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

mikebrooking avatar image
mikebrooking answered demskigroup commented

Can you try it with a fully qualified CUSTOM_ACTIVITY_NAME ?

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.

Yes, already tried that as well and got the same result.
0 Likes 0 ·
Is there any other info I can provide that might help?
0 Likes 0 ·
Blake Williams avatar image
Blake Williams answered demskigroup commented

The CUSTOM_ACTIVITY_NAME should be the action value. i.e. “com.yourdomain.ACTIVITY_NAME” as defined in the manifest.

10 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.

Yes, already tried that as well and got the same result.

0 Likes 0 ·

Is there any other info I can provide that might help?

0 Likes 0 ·
What device are you using? Station/Mini or Duo?
0 Likes 0 ·
Show more comments
mikebrooking avatar image
mikebrooking answered demskigroup commented

Yes, I can

3 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.

I just caused the crash do I send the id right here?
0 Likes 0 ·
Yes, that is fine.
0 Likes 0 ·
It's C050UQ82030055
0 Likes 0 ·
mikebrooking avatar image
mikebrooking answered
01-13 11:20:35.161  2039  4133 E AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
01-13 11:20:35.161  2039  4133 E AndroidRuntime: Process: zoomifi.charitycheckout, PID: 2039
01-13 11:20:35.161  2039  4133 E AndroidRuntime: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at android.os.Handler.<init>(Handler.java:200)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at android.os.Handler.<init>(Handler.java:114)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at android.widget.Toast$TN$2.<init>(Toast.java:336)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at android.widget.Toast$TN.<init>(Toast.java:336)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at android.widget.Toast.<init>(Toast.java:103)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at android.widget.Toast.makeText(Toast.java:256)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at zoomifi.charitycheckout.SaleDialogActivity.lambda$onCreate$0$SaleDialogActivity(SaleDialogActivity.java:139)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at zoomifi.charitycheckout.-$$Lambda$SaleDialogActivity$2QGg0iJ8wgi0YMnH1pXaYzSic7Q.run(lambda)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
01-13 11:20:35.161  2039  4133 E AndroidRuntime:     at java.lang.Thread.run(Thread.java:761)
01-13 11:20:35.162   950  1473 I am_crash: [2039,0,zoomifi.charitycheckout,952680004,java.lang.RuntimeException,Can't create handler inside thread that has not called Looper.prepare(),Handler.java,200]
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