Use the react-native run-Android plugin recommended by the community, and configure it according to the document. When the configuration is complete, use the react-native run-Android to start the project, which may report an error. Find the file that reported the error and delete @override on that line.
Call method:
import Alipay from 'react-native-yunpeng-alipay';
Alipay.pay("signed pay info string").then(function(data){// The argument to the pay method is the paid signature information given to you by the background. console.log(data); },function (err) {
console.log(err);
});
Copy the code
If your mobile phone has alipay, you can already call up alipay at this time. (^ del ^)
If you want to realize the function of opening the H5 page for payment without Alipay APP, look at the official document of Alipay and add the following permissions to androidmanifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Copy the code
Add the following code to androidmanifest.xml. Note that the following code must be a child of
:
<activity
android:name="com.alipay.sdk.app.H5PayActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="com.alipay.sdk.app.H5AuthActivity"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
Copy the code
(Also remember: build.grade and androidmanifest.xml targetSdkVersion must be at least 23 to use !!!!!!!!!!!!!)
And then you’re done!!