Priyanka Samanta Priyanka Samanta - 5 months ago 25
Android Question

Need to access native interface code (android paypal integration) from codename one

I have write some paypal integration code with android under native interface Impl.I have copied the paypal SDK and android-support-v4 under native/android folder. Can anyone please help with the required android.xapplication and android.xpermissions.
need to include the below entries:

<uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permissionandroid:name="android.permission.INTERNET"/>
<actionandroid:name="android.intent.action.MAIN"/>
<categoryandroid:name="android.intent.category.LAUNCHER"/>
<serviceandroid:name="com.paypal.android.sdk.payments.PayPalService"android:exported="false"/>
<activityandroid:name="com.paypal.android.sdk.payments.PaymentActivity"/>
<activityandroid:name="com.paypal.android.sdk.payments.LoginActivity"/>
<activityandroid:name="com.paypal.android.sdk.payments.PaymentMethodActivity"/>
<activityandroid:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"/>
<activityandroid:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity"/>
<activityandroid:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity"/>
<activityandroid:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity"/>
<activityandroid:name="io.card.payment.DataEntryActivity"/>

Answer
  1. Internet permission is already added by default by codenameone so need to ask for it.

  2. The android-support-v4 is also added by default so no need to add it.

In the build hints settings UI set:

android.xapplication=<service android:name="com.paypal.android.sdk.payments.PayPalService"android:exported="false"/> 
<activity android:name="com.paypal.android.sdk.payments.PaymentActivity"/> 
<activity android:name="com.paypal.android.sdk.payments.LoginActivity"/> 
<activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity"/> 
<activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"/> 
<activity android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity"/> 
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity"/> 
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity"/> 
<activity android:name="io.card.payment.DataEntryActivity"/>

android.xpermissions=<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

Or alternatively open your codenameone_settings.properties and add the following:

codename1.arg.android.xapplication=<service android\:name\="com.paypal.android.sdk.payments.PayPalService"android\:exported\="false"/>  <activity android\:name\="com.paypal.android.sdk.payments.PaymentActivity"/>  <activity android\:name\="com.paypal.android.sdk.payments.LoginActivity"/>  <activity android\:name\="com.paypal.android.sdk.payments.PaymentMethodActivity"/>  <activity android\:name\="com.paypal.android.sdk.payments.PaymentConfirmActivity"/>  <activity android\:name\="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity"/>  <activity android\:name\="com.paypal.android.sdk.payments.FuturePaymentConsentActivity"/>  <activity android\:name\="com.paypal.android.sdk.payments.FuturePaymentInfoActivity"/>  <activity android\:name\="io.card.payment.DataEntryActivity"/>



codename1.arg.android.xpermissions=<uses-permission android\:name\="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android\:name\="android.permission.ACCESS_WIFI_STATE"/>
Comments