fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.6k stars 962 forks source link

[Request]: device_info_plus can't find device name #1029

Open Capricornwqh opened 2 years ago

Capricornwqh commented 2 years ago

Plugin

device_info_plus

Use case

AndroidDeviceInfo can't find device name Screenshot_20220819_163759

Proposal

AndroidDeviceInfo and IosDeviceInfo need add device name item

saksham-gt commented 2 years ago

Hey @Capricornwqh, I used this plugin on my Android device (Android 12) and it's working fine. Can you tell what's the error?

Capricornwqh commented 2 years ago

which item you used? AndroidDeviceInfo.device or AndroidDeviceInfo.display? more precisely, i need display Bluetooth Device Name.

saksham-gt commented 2 years ago

I don't think it's for fetching your Bluetooth device name.

Capricornwqh commented 2 years ago

other devices will see this name when use Bluetooth, Personal hotspot and USB. whaterver, AndroidDeviceInfo can't find this name.

mmcdon20 commented 2 months ago

The device name can looked up on android with the following (kotlin).

import android.provider.Settings

val name = Settings.Global.getString(applicationContext.contentResolver, "device_name")

You can try using global settings list package to look this up.

import 'package:global_settings_list/global_settings_list.dart';

String? name = await GlobalSettingsList.deviceName;