MethodChannelDeviceIdentifierPlugin class
An implementation of DeviceIdentifierPluginPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- DeviceIdentifierPluginPlatform
- MethodChannelDeviceIdentifierPlugin
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- methodChannel → MethodChannel
-
The method channel used to interact with the native platform.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
deleteFileDeviceIdentifier(
{String fileName = 'device_id.txt', String folderName = 'DeviceIdentifier'}) → Future< bool> -
删除文件存储的设备标识符
Android专属接口
override
-
generateFileDeviceIdentifier(
{String fileName = 'device_id.txt', String folderName = 'DeviceIdentifier'}) → Future< String?> -
生成并返回基于文件的设备标识符
Android专属接口
folderName
文件夹名称,默认为 'DeviceIdentifier'fileName
文件名,默认为 'device_id.txt' 返回生成的设备ID字符串,如果权限不足或创建失败则返回nulloverride -
generateKeychainUUID(
) → Future< String?> -
生成钥匙串UUID
iOS专属接口
如果已成在则返回现有UUID,否则生成新的UUID并存储
override
-
getAdvertisingIdForAndroid(
) → Future< String?> -
获取广告标识符
Android接口
Android返回的是GAID - Google Advertising ID,此ID需要设备支持谷歌服务
override
-
getAdvertisingIdForiOS(
) → Future< String?> -
获取广告标识符
iOS接口
返回的是IDFA - Identifier for Advertisers,此ID需要用户授权
override
-
getAndroidId(
) → Future< String?> -
获取Android ID
Android专属接口
override
-
getAppleIDFV(
) → Future< String?> -
获取idfv
iOS专属接口
返回IDFV(Identifier for Vendor),同一开发者应用共享
override
-
getDeviceInfo(
) → Future< Map< String, String?> > -
获取设备信息
Android和iOS通用接口
Android返回如下:
override
-
getFileDeviceIdentifier(
{String fileName = 'device_id.txt', String folderName = 'DeviceIdentifier'}) → Future< String?> -
获取基于文件的设备标识符
Android专属接口
folderName
文件夹名称,默认为 'DeviceIdentifier'fileName
文件名,默认为 'device_id.txt' 返回设备ID或null,如果为null则表示未找到或未生成override -
getKeychainUUID(
) → Future< String?> -
获取钥匙串UUID
iOS专属接口
返回存储在钥匙串中的UUID,最稳定的标识符
如果未存储则返回null
override
-
getPlatformVersion(
) → Future< String?> -
获取平台版本
override
-
getSupportedIdentifiers(
) → Future< Map< String, dynamic> > -
获取设备支持的标识符
Android和iOS通用接口
Android会返回:
override
-
getWidevineDrmId(
) → Future< String?> -
获取DRM ID
Android接口
如果设备不支持,则返回null
override
-
hasExternalStoragePermission(
) → Future< bool> -
Android特有的方法:检查外部存储权限是否已被授予
返回true表示已授予读写外部存储权限,false表示未授予
override
-
hasFileDeviceIdentifier(
{String fileName = 'device_id.txt', String folderName = 'DeviceIdentifier'}) → Future< bool> -
检查是否存在文件存储的设备标识符
Android专属接口
override
-
hasKeychainUUID(
) → Future< bool> -
检查是否存在钥匙串UUID
iOS专属接口
返回true表示存在钥匙串UUID,false表示不存在
override
-
isEmulator(
) → Future< bool> -
检查是否为模拟器
Android和iOS通用接口
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestExternalStoragePermission(
) → Future< void> -
Android特有的方法:请求读写外部存储权限
在Android 11及以上版本中,需要动态请求权限才能访问外部存储
override
-
requestTrackingAuthorization(
) → Future< String?> -
iOS 特有方法:请求广告追踪权限
override
-
setKeychainServiceAndAccount(
{String service = 'com.hicyh.getdeviceid.keychain', String keyAccount = 'device_uuid', String deviceIDAccount = 'ios_device_id'}) → Future< void> -
设置钥匙串的服务和账户名称
iOS专属接口
用于自定义钥匙串存储位置
service
钥匙串服务名称,默认为 'com.hicyh.getdeviceid.keychain'keyAccount
钥匙串账户名称,默认为 'device_uuid'deviceIDAccount
钥匙串设备ID账户名称,默认为 'ios_device_id' 如果不设置则使用默认值 如果需要在iOS中使用钥匙串存储设备标识符, 请在调用其他钥匙串相关方法之前先调用此方法设置服务和账户名称 注意:此方法仅在iOS平台上有效,Android平台不支持钥匙串存储override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited