Closed dagovalsusa closed 3 years ago
If you add device_info: ^1.0.0
to your pubspec.yaml, you can use the features in the Device info plugin.
Then, you can do eg.
_mixpanel.engage(
operation: MixpanelUpdateOperations.$set,
value: {
"OsVersion": getOsVersion(),
...
},
...
);
(there are many other fields you can add, and in this example OsVersion
is a custom field. You can name it whatever you want.)
This sets the current user profile info to include the given parameters. You can set the profile's unique id as seen in this plugin's example, with the _user
stream.
and then populate the os version with:
import 'dart:io'; // For Platform.isAndroid, etc
import 'package:device_info/device_info.dart'; // for DeviceInfoPlugin
...
static setDeviceInfo() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) {
_androidInfo = await deviceInfo.androidInfo;
}
if (Platform.isIOS) {
_iosInfo = await deviceInfo.iosInfo;
}
}
static String getOsVersion() {
if (_androidInfo != null) return "Andriod " + _androidInfo.version.baseOS;
if (_iosInfo != null) return "iOS " + _iosInfo.systemVersion;
return "";
}
Os version is just an example, there's plenty of other device info you can get with this plugin.
Thanks @NateWilliams2 for the accurate answer. I think we can close this issue.
Hello, can I upload device info with track method? Thanks