# Open API
# getAccountInfoSync
Get current account information
Return Value
Object object
| Property | Type | Description |
|---|---|---|
| miniProgram | Object | Mini-Program account information |
| plugin | Object | Plugin account information (only included when called within a plugin) |
Structure of object.miniProgram
| Property | Type | Description |
|---|---|---|
| appId | string | Mini-Program appId |
| envVersion | string | Mini-Program version |
| version | string | Online Mini-Program version number |
Structure of object.plugin
| Property | Type | Description |
|---|---|---|
| appId | string | Plugin appId |
| version | string | Plugin version number |
Sample Code
const accountInfo = ft.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId) // Mini-Program appId
# authorize
Preemptively request authorization from the user.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| scope | string | yes | The scope for which permission is required, see the scope list for details | |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executes on both success and failure) |
Sample Code
// Can be passed ft.getSetting Check to see if the user is authorized "scope.record" this scope
// You can first query whether the user has authorized the "scope.record" scope via ft.getSetting
ft.getSetting({
success(res) {
if (!res.authSetting['scope.record']) {
ft.authorize({
scope: 'scope.record',
success () {
// The user has agreed that the Mini-Program can use the recording function; subsequent calls to the ft.startRecord API will not prompt for confirmation
ft.startRecord()
}
})
}
}
})
# openSetting
Open the client Mini-Program settings interface and return the result of the user's settings operation.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| withSubscriptions | Boolean | false | No | Whether to also retrieve the user's subscription status for subscription messages; defaults to not retrieving. |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executes on both success and failure) |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| authSetting | AuthSetting | User authorization result |
| subscriptionsSetting | SubscriptionsSetting | User subscription message settings; only returned when the interface parameter withSubscriptions is true |
Sample Code
ft.openSetting({
success (res) {
console.log(res.authSetting)
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})
# getSetting
Get the user's current settings.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| withSubscriptions | Boolean | false | No | Whether to also retrieve the user's subscription status for subscription messages; defaults to not retrieving. |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executes on both success and failure) |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| authSetting | AuthSetting | User authorization result |
| subscriptionsSetting | SubscriptionsSetting | User subscription message settings; only returned when the interface parameter withSubscriptions is true |
| miniprogramAuthSetting | AuthSetting | When called within a plugin, the user authorization result of the current Host-App Mini-Program |
Sample Code
ft.getSetting({
success (res) {
console.log(res.authSetting)
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})
# AuthSetting
User authorization settings information. For details, refer to Permissions.
Properties
boolean scope.userInfo
Whether user information is authorized, corresponding to the API ft.getUserInfo
boolean scope.userLocation
Whether geographic location is authorized, corresponding to the APIs ft.getLocation, ft.chooseLocation
boolean scope.address
Whether the mailing address is authorized. This authorization has been cancelled; it will default to returning true.
boolean scope.invoiceTitle
Whether the invoice title is authorized. This authorization has been cancelled; it will default to returning true.
boolean scope.invoice
Whether invoice retrieval is authorized. This authorization has been cancelled; it will default to returning true.
boolean scope.werun
Whether step count is authorized, corresponding to the API ft.getWeRunData
boolean scope.record
Whether the recording function is authorized, corresponding to the API ft.startRecord
boolean scope.writePhotosAlbum
Whether saving to the photo album is authorized, corresponding to ft.saveImageToPhotosAlbum, ft.saveVideoToPhotosAlbum
boolean scope.camera
Whether the camera is authorized, corresponding to the camera component
boolean scope.bluetooth
Whether Bluetooth is authorized, corresponding to the APIs ft.openBluetoothAdapter, ft.createBLEPeripheralServer
boolean scope.addPhoneContact
Whether adding phone contacts is authorized, corresponding to the API ft.addPhoneContact
boolean scope.addPhoneCalendar
Whether the system calendar is authorized, corresponding to the APIs ft.addPhoneRepeatCalendar, ft.addPhoneCalendar