📱

Device profile

Once a user is registered, the profile is automatically created. However, it's important to keep this profile up to date. This can be achieved with the following snippet.

Update Profile

The heading of the reports displays information about the version of the app and the last used device. This information can be updated with the sdk.updateProfile function.
Flutter
React Native
import 'package:flutter_fibricheck_sdk/flutter_fibricheck_sdk.dart';
import 'package:device_info_plus/device_info_plus.dart';
​
var deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo;
IosDeviceInfo iosInfo;
​
String? os;
String? model;
String? manufacturer;
​
if (Platform.isAndroid) {
androidInfo = await deviceInfo.androidInfo;
os = androidInfo.version.release;
model = androidInfo.model;
manufacturer = androidInfo.manufacturer;
} else if (Platform.isIOS) {
iosInfo = await deviceInfo.iosInfo;
os = iosInfo.systemVersion;
model = iosInfo.localizedModel;
manufacturer = 'Apple';
}
​
await _sdk.updateProfile(
"1234567890",
ProfileData(
addressLine1: "",
addressLine2: "",
weight: int,
length: int,
smoker: bool,
activity: ProfileActivity...,
fibricheckInfo: FibricheckInfo(
app: App(version: "1.0.0"),
device: Device(
manufacturer: manufacturer,
type: Platform.isAndroid ? DeviceType.android : DeviceType.ios,
model: model,
os: iosInfo.systemVersion,
),
)));
import DeviceInfo from 'react-native-device-info';
​
const appVersion = DeviceInfo.getVersion();
const isAndroid = Platform.OS === 'android';
​
const deviceOSVersion = DeviceInfo.getSystemVersion();
const deviceModel = isAndroid
? DeviceInfo.getModel()
: DeviceInfo.getDeviceId();
deviceSystemName = isAndroid ? 'android' : 'ios';
deviceManufacturer = await DeviceInfo.getManufacturer();
​
const profileData = {
birthday: '06/07/1990';
gender: Gender.Male;
fibricheck_info:
app: {
version: appVersion,
},
device: {
os: deviceOSVersion,
model: deviceModel,
type: deviceSystemName,
manufacturer: deviceManufacturer,
}
}
};
​
await sdk.updateProfile('1234567890', profileData);