Hi,
We are trying to implement customer facing activity as it is explained on this page: https://docs.clover.com/docs/using-customer-facing-platform . On page it is written that we can use CPF SDK on Clover Station Pro or a Clover Station tethered to a Clover Mini. We are using Clover Station tethered to a Clover Mini and we have some issues when we try to start our Customer Activity.
When we connect our Clover MINI to Clover Station and we run USB Pay Display application our MINI goes to IDLE state and on screen we can see Welcome message.
After everything is set up, we are trying to start custom Activity from our application installed on Clover Station but screen on Clover Mini doesn't show our CFP Activity. Screen just flush and for second there is progress dialog visible, and after that Welcome screen is shown.
Here is part of our code, so you can see how are we trying to start CFP activity, and maybe figured out what are we doing wrong:
AndroidManifest.xml
<activity android:name=".views.CustomerActivity" android:launchMode="singleTop" android:noHistory="true" android:windowSoftInputMode="adjustResize" android:fitsSystemWindows="true" android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"> <intent-filter> <action android:name="com.loyalzoo.loyalzooclover.views.CustomerActivity"/> <category android:name="com.clover.cfp.ACTIVITY"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity>
MainActivity:
private static final String CUSTOM_ACTIVITY_NAME = "com.loyalzoo.loyalzooclover.views.CustomerActivity"; final String payload = "{\"msg\"=\"Initial...\"}"; // if you need an inital payload final CustomActivityRequest car = new CustomActivityRequest(CUSTOM_ACTIVITY_NAME, payload); executor.execute(()->{ remoteDeviceConnector.connect(); DeviceStatusResponse deviceStatusResponse = remoteDeviceConnector.retrieveDeviceStatus(new DeviceStatusRequest()); if(deviceStatusResponse.state.equals(ExternalDeviceState.IDLE)) { remoteDeviceConnector.startCustomActivity(car, new CustomActivityListener() { @Override public void onMessageFromActivity(MessageFromActivity message) { } @Override public void onCustomActivityResult(CustomActivityResponse response) { } }); } });
CustomerActivity:
public class CustomerActivity extends CloverCFPActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int orientation = this.getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { setContentView(R.layout.activity_basic_example_portrait); findViewById(R.id.basic_example_port_layout).setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); return true; } }); } else{ setContentView(R.layout.activity_basic_example); findViewById(R.id.basic_example_land_layout).setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); return true; } }); } } @Override public void onMessage(String payload) {} @Override protected void onResume() { super.onResume(); String payload = getIntent().getStringExtra(CFPConstants.EXTRA_PAYLOAD); ((TextView)findViewById(R.id.payload)).setText(payload); } public void finishClicked(View view) { String payload = ((EditText)findViewById(R.id.resultPayload)).getText().toString(); setResultAndFinish(RESULT_OK, payload); } }
It is also quite unusual that CloverCFPActivity class is marked as deprecated, and we are using cfp-sdk 4.2.1
implementation "com.clover.cfp:clover-cfp-sdk:4.2.1
Is that supposed to be like that or we are pulling something wrong?
Looking forward to your answer.
Best regard