question

hduran18 avatar image
hduran18 asked

Integrar proyecto de react native con clover


I have problem with the context in the mosulo that I call from native react

public class PaymentModule extends ReactContextBaseJavaModule  {

    public PaymentModule(ReactApplicationContext context) {
                 super(context);}

   @Override
    public String getName() { return "PaymentModule";}

    @ReactMethod
    public void paymentEvent() {
       System.out.println("Ya ejecute");
       Mainprocess mainprocess = new Mainprocess();
        mainprocess.getData();
    }

    private Intent buildPaymentRequestIntent() {
        String externalPaymentId = "<posPaymentId>"; // should be unique for each request
        long amount = 1000;
        Context contextt = this;
        PaymentRequestIntentBuilder builder = new PaymentRequestIntentBuilder(externalPaymentId, amount);
        return builder.build(contextt);
    }





}
Try to fix it by creating another java class and calling it from Paymentmodule



public void paymentEvent() {
   System.out.println("Ya ejecute");
   Mainprocess mainprocess = new Mainprocess();
    mainprocess.getData();
}


public class Mainprocess extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    
    public void getData(){
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Desde el proceso");
//                Intent intent = buildPaymentRequestIntent();
            }
        });

    }
    
    private Intent buildPaymentRequestIntent() {
        String externalPaymentId = "<posPaymentId>"; // should be unique for each request
        long amount = 1000;
        Context context = this;

        PaymentRequestIntentBuilder builder = new PaymentRequestIntentBuilder(externalPaymentId, amount);
        return builder.build(context);
    }

}



but when executing the ract native application and launching that function it generates this error



1664038241345.png

Agradesco su ayuda

Clover Android SDK
1664037993873.png (62.4 KiB)
1664038241345.png (22.0 KiB)
10 |2000

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

0 Answers

·

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