Flutter DeviceConnect
The plugin can be used to integrate mobile apps with DeviceConnect so that users can share their data.
NOTE
Following will be shared by FinBox team at the time of integration:
ACCESS_KEY
SECRET_KEY
DC_SDK_VERSION
COMMON_SDK_VERSION
COMMON_FLAVOR
LOGGER_SDK_VERSION
CLIENT_API_KEY
Add Plugin
Specify the following in local.properties
file:
ACCESS_KEY=<ACCESS_KEY>
SECRET_KEY=<SECRET_KEY>
DC_SDK_VERSION=<RM_SDK_VERSION>
COMMON_SDK_VERSION=<COMMON_SDK_VERSION>
COMMON_FLAVOR=<COMMON_FLAVOR>
LOGGER_SDK_VERSION=<LOGGER_SDK_VERSION>
Add plugin dependency in pubspec.yaml
file:
finbox_dc_plugin: any
Create User
Call FinBoxDcPlugin.createUser(<CLIENT_API_KEY>, <CUSTOMER_ID>)
to share users data.
FinBoxDcPlugin.createUser("CLIENT_API_KEY", "CUSTOMER_ID").fold(
(right) => {
// Authentication is success
print("Access Token: $right")
},
(left) => {
// Authentication failed
print("Error Code $left")
});
You can read about the errors in the Error Codes section.
Start Periodic Sync
This is to be called only on a successful response to createUser method's callback. On calling this the syncs will start for all the data sources configured as per permissions. The method below syncs data in the background at regular intervals.
FinBoxDcPlugin.startPeriodicSync();
Error Codes
Below table contains the constant name, error code value and the description of error code:
::: tip TIP All the constants stated below are available as constants in SDK. :::
Constant Name | Constant Value | Description |
---|---|---|
QUOTA_LIMIT_EXCEEDED | 7670 | API Key exceeded its quota limit |
AUTHENTICATE_FAILED | 7671 | Authentication of the API Key and the User failed |
AUTHENTICATE_API_FAILED | 7672 | Authentication of the API Key failed |
AUTHORIZATION_API_FAILED | 7673 | Authorization of the API Key failed |
AUTHENTICATE_API_EMPTY | 7676 | API key is empty |
AUTHENTICATE_USER_EMPTY | 7677 | User name is empty |
NO_ACTIVE_NETWORK | 7678 | Device is not connected to an active network |
NETWORK_TIME_OUT | 7679 | Request timed out |
NETWORK_RESPONSE_NULL | 7681 | Network response is null |
USER_TOKENS_NULL | 7682 | Both access token and refresh token is null |
ACCESS_TOKEN_NULL | 7683 | Access token is null |
REFRESH_TOKEN_NULL | 7684 | Refresh token is null |
AUTHENTICATE_NOT_FOUND | 7685 | End point is not found |
Some error codes can be resolved by validating the implementation and some by retrying the creation of the user, while other error codes can only be resolved by contacting FinBox.