How we get device name in ionic 3?
for example iPhone 5,iPhone 7,Samsung Galaxy S3
Hey @cooldp007,
did you took a look on the API dcos? This plugin should actually solve your problem:
device.model
The device.model returns the name of the device's model or product. The value is set by the device manufacturer and may be different across versions of the same product.
Supported Platforms
Android
Browser
iOS
Windows
OSX
Quick Example
// Android: Nexus One returns "Passion" (Nexus One code name)
// Motorola Droid returns "voles"
// BlackBerry: Torch 9800 returns "9800"
// Browser: Google Chrome returns "Chrome"
// Safari returns "Safari"
// iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models
// OSX: returns "x86_64"
//
var model = device.model;
Good luck,
Oliver
I would have also a look on this one: http://www.droidviews.com/list-of-android-device-codenames/
I did not find a CSV for this data, but at least you could assign a code to a real device name. Just save yourself time and code a simple API.
I found some JSON: https://raw.githubusercontent.com/jaredrummler/AndroidDeviceNames/master/json/devices.json
Hello, @odorakel
Thanks for giving me various solution for my query
Now i take device width and height by this.platform.width() and this.platform.height() and from width and height i will judge
for e.g. if width is 320 and height is 568 then i know that it is iPhone 5
@cooldp007: This solutions works prob perfectly with IOS devices. But Android seems to be a little bit more complex.
Keep calm and code on…