| 1 | ''' |
| 2 | Module of Android API for plyer.devicename. |
| 3 | ''' |
| 4 | |
| 5 | from jnius import autoclass |
| 6 | from plyer.facades import DeviceName |
| 7 | |
| 8 | Build = autoclass('android.os.Build') |
| 9 | |
| 10 | |
| 11 | class AndroidDeviceName(DeviceName): |
| 12 | ''' |
| 13 | Implementation of Android devicename API. |
| 14 | ''' |
| 15 | |
| 16 | def _get_device_name(self): |
| 17 | """ |
| 18 | Method to get the device name aka model in an android environment. |
| 19 | |
| 20 | Changed the implementation from 'android.provider.Settings.Global' to |
| 21 | 'android.os.Build' because 'android.provider.Settings.Global' was |
| 22 | introduced in API 17 whereas 'android.os.Build' is present since API 1 |
| 23 | |
| 24 | Thereby making this method more backward compatible. |
| 25 | """ |
| 26 | return Build.MODEL |
| 27 | |
| 28 | |
| 29 | def instance(): |
| 30 | ''' |
| 31 | Instance for facade proxy. |
| 32 | ''' |
| 33 | return AndroidDeviceName() |