question

mtt avatar image
mtt asked Greg answered

CFP returning error

Hi all,
I'm new to Clover Android development (and pretty new to Android development in general)
I'm trying to run a simple custom activity, but it keeps return the following error:

{"success":false,"result":"CANCEL","reason":"Custom activity cancelled by transition to remote-pay activity","action":"***.MainActivity"}
Here's my MainActivity.java:
package ***;

//import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.clover.cfp.activity.CloverCFPActivity;

public class MainActivity extends CloverCFPActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    protected void onMessage(String message) {
        try {
            sendMessage(message);
        } catch(Exception e) {

        }
    }
}
And manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="***">

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="***.MainActivity"
            android:launchMode="singleTop"
            android:noHistory="true"
            android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"
            android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="com.clover.cfp.examples.BasicExample"/>
                <category android:name="com.clover.cfp.ACTIVITY"/>
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

remote-pay-cloud JS call:

var request = new clover.remotepay.CustomActivityRequest()
      request.setAction("***.MainActivity");
      request.setPayload("ggggggggg");
      request.setNonBlocking(false);
      cloverConnector.startCustomActivity(request);
semi-integrationsCloud Pay DisplayRemote Pay Cloud
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.

Greg avatar image Greg commented ·

Hi @mtt,

Can you provide the log from the device when you try to launch the Custom Activity? If you are on a devkit you can adb in and see what the actual error message is. It might be that the custom activity cannot be found (you should see ActivityNotFound Exception in the logs for example).

0 Likes 0 ·
mtt avatar image mtt Greg commented ·

Hey greg, you're totally correct. I'm getting:

I/RemoteTerminalKioskActivity(12323): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=***.MainActivity cat=[com.clover.cfp.ACTIVITY] (has extras) }

What am I missing? I believe my manifest looks correct. Is there something I need to go to get Clover to recognize my activity?

0 Likes 0 ·

1 Answer

Greg avatar image
Greg answered

The message describes an intent looking action=***.MainActivity with category="com.clover.cfp.ACTIVITY". You do not have such an activity in your intent filter.

For <activity android:name="***.MainActivity"

1) Change android:name="***.MainActivity" to just ".MainActivity"

Under the intent filter:

2) Change <action android:name="com.clover.cfp.examples.BasicExample"/> to your full package name like so:

<action android:name="***.MainActivity"/>

(this is the package name the intent is looking for)

1 comment
10 |2000

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

mtt avatar image mtt commented ·

Thanks Greg. That fixed it!

0 Likes 0 ·

Welcome to the
Clover Developer Community