This project implements API of Humaniq Mobile for react engine.
Firstly need to update up to latest version of github repository.
npm uninstall react-native-android-library-humaniq-api npm install --save git+https://github.com/humaniq/react-native-android-library-humaniq-api.git
After download latest version of java library (gate thrue java to api endpoint) may use library functions.
-
For check linked java library you can do instructions:
after this action, current module will be available for use.
for sample toast message use this sample:
import {HumaniqToastApiLib} from 'react-native-android-library-humaniq-api'; HumaniqToastApiLib.show(‘Boilerplate runs fine’, HumaniqApiLib.LONG)
There are different modules available for using:
ContactModule, DownloadModule, ProfileModule, ToastModule - uses for test library.
ContacnModule has implemented this api call:
@POST("/contact-checker/api/v1/extract_registered_phone_numbers") Call<ContactsResponse> extractPhoneNumbers(@Body List<String> data);
this function may be call in react-native .js file:
HumaniqToastApiLib.extractAllPhoneNumbers().then((array) => { console.warn(array); });
-
in array object will use postman response, just redirect data from backend via java library to react-native app.
Structure of data presented at
{ "success": true, "data": [ "+7(910)1234567", "+7( 910) 987-65-43" ] }
#Attention before use extractAllPhoneNumbers(), need to call and approve by user PermissionsAndroid.PERMISSIONS.WRITE_CONTACTS permission from react side. More details presented at this link https://facebook.github.io/react-native/docs/permissionsandroid.html
-
Profile module (module consist api functions for any profile data requests) - HumaniqProfileApiLib. This module conists functions:
public void getAddressState(String id, final Promise promise); public void getTransactions(String id, final Promise promise); public void getTransactions(String id, int offset, int limit, final Promise promise); public void getBalance(String id, final Promise promise); public void createTransaction(String fromUserId, String toUserId, float amount, final Promise promise); public void updateUserPerson(String accountId, String firstName, String lastName, final Promise promise); public void uploadProfileAvatar(String accountId, String avatarBse64, final Promise promise); public void changeProfilePassword(String oldPassword, String newPassword) - not yet released, only mock data; public void deauthenticateUser(String accountId, final Promise promise);
-
Download module (module consist api functions for download any files) - HumaniqDownloadFileLib This module consists functions: public void downloadVideoFile(String uri, final Promise downloadPromise); this function allow you to download any-size files from internet.
public void downloadVideoFile(String uri, final Promise downloadPromise) private void sendEvent(@Nullable WritableMap params) - every time provide progress status of file downloading. Use RCTDeviceEventEmitter class for this purpose.
-
Blockchain module contains this functions
public void transferHmq(String fromId, String toId, int amount, final Promise promise)
for building libraries uses this resources: http://cmichel.io/how-to-create-react-native-android-library/