Return raw DeviceId value for iOS (at least)
See original GitHub issueDescription
Current Implementation for DeviceInfo.getModel()
NSString* deviceName = [deviceNamesByCode objectForKey:self.deviceId];
if (!deviceName) {
// Not found on database. At least guess main device type from string contents:
if ([self.deviceId rangeOfString:@"iPod"].location != NSNotFound) {
deviceName = @"iPod Touch";
}
else if([self.deviceId rangeOfString:@"iPad"].location != NSNotFound) {
deviceName = @"iPad";
}
else if([self.deviceId rangeOfString:@"iPhone"].location != NSNotFound){
deviceName = @"iPhone";
}
else if([self.deviceId rangeOfString:@"AppleTV"].location != NSNotFound){
deviceName = @"Apple TV";
}
}
return deviceName;
Suggested Implementation:
NSString* deviceName = [deviceNamesByCode objectForKey:self.deviceId];
if (!deviceName) {
// Not found in the list
deviceName = self.deviceId;
}
return deviceName;
Use Case
When ever Apple releases new devices we have wait till this library is updated to get device model, currently we get only iPhone or iPad for new versions.
Better to return deviceId as default for new devices, which will be useful in analytics…
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
UIDevice uniqueIdentifier deprecated - What to do now?
For apps still using uniqueIdentifier, iOS7 now returns FFFFFFFF + identifierForVendor which is breaking a lot of badly written non-renewing subscription apps.
Read more >Mobile Device Management Protocol Reference
The Mobile Device Management (MDM) protocol provides a way for system administrators to send device management commands to managed iOS ...
Read more >Default Properties Collected by Mixpanel
Mp Api Endpoint (raw property name: $mp_api_endpoint) This is the value of the Host Header based on the request to our ingestion service....
Read more >Track unique users in Amplitude
This section explains in detail how Amplitude generates an Amplitude ID in different scenarios. Use advertising identifiers as the device ID.
Read more >Global device ID validation | Adobe Audience Manager
Following is an example of an error returned because the ID is sent in as an Apple IDFA, which should only contain upper...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah getDeviceId additional function is also good option for both platform.
FYI - here’s how I’m going to maintain the getModel/getDevice APIs for iOS going forward https://github.com/react-native-community/react-native-device-info/pull/618#issuecomment-479661030