Dima Portenko
Dima Portenko

Reputation: 3854

Is there way to check device model in Apportable SDK?

I have to implement some special behaviour for particular device model. So I need to check device model.

I'm using

[UIDevice currentDevice] name];

but it's return me something like this

Nexus 7 running Apportable

I think it's kind of weird result. Any other way to do it?

Upvotes: 1

Views: 116

Answers (1)

Paul Beusterien
Paul Beusterien

Reputation: 29582

use [[UIDevice currentDevice] nativeModel]

NSLog(@"%@", [[UIDevice currentDevice] nativeModel]);

will generate D/Spin ( 3956): 2014-04-14 09:44:21.446 Spin[3956:2752] Nexus 7 in logcat output

There is more information about the UIDevice API extensions in .apportable/SDK/System/UIKit/UIDevice.h

Apportable typically makes API decisions for iOS ports to be as seamless as possible. If you actually want an Android specific result, a non-iOS API extension is usually created.

Here are some details on the UIDevice.h mappings to the Android Build API's:

@property (nonatomic, readonly) NSString *nativeSystemName;    -> @"Android" 
@property (nonatomic, readonly) NSString *nativeCPUABI;        -> Build.CPU_ABI
@property (nonatomic, readonly) NSString *nativeModel;         -> Build.MODEL
@property (nonatomic, readonly) NSString *nativeProduct;       -> Build.PRODUCT
@property (nonatomic, readonly) NSString *nativeManufacturer;  -> Build.MANUFACTURER
@property (nonatomic, readonly) NSString *nativeSystemVersion; -> Build.RELEASE
@property (nonatomic, readonly) NSUInteger nativeSDKVersion;   -> Build.SDK_INT

Upvotes: 2

Related Questions