2021-01-12 08:39

isTablet() Returns Wrong Value for iPad (5th generation)


DeviceInfo.isTablet() returns wrong value for "iPad (5th generation)" Simulator. May be true for real device as well. The Library uses a Configuration for Android Screen Sizes to detect if the device is a tablet. This is results in the wrong value. How about we split the detection for Android and iOS in order to tackle this issue. For now at least iPads have a different aspect ratio as iPhones. This could be used to detect iOS tablets at least. Not sure if it's true for Android devices.

Current behavior

DeviceInfo.isTablet() returns FALSE for iPad (5th generation)

Expected behavior

DeviceInfo.isTablet() returns TRUE for iPad (5th generation)


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39528366 weixin_39528366 4月前

    Hi ,

    The Android and iOS detections are completely separated unless I'm missing something. Here's how we do it for iOS:

    - (bool) isTablet
      return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
    点赞 评论 复制链接分享
  • weixin_39528366 weixin_39528366 4月前

    Closing this issue as no feedback was provided. Feel free to open it again if the problem still happens

    点赞 评论 复制链接分享
  • weixin_39601743 weixin_39601743 4月前

    same issue with IOs only. I've tried at many Ipad emulators, isTablet is returning false, while working as expected on android

    点赞 评论 复制链接分享
  • weixin_39901685 weixin_39901685 4月前

    Is there any solutions for how to get correct value for ipad?

    点赞 评论 复制链接分享
  • weixin_39617405 weixin_39617405 4月前

    Huh. I just checked this on a tablet emulator and sure enough, the example returns false for this tablet! However, I noticed the UI was doing the phone-locked UI thing where I could expand it etc, but it was not using the iPad like a tablet.

    When I changed the build from "iPhone" to "Universal" in the General -> Deployment Info area of XCode for the example, it worked - isTablet() returned true.

    So this may be a build-setting thing. You can tell from getDeviceId() that your hardware is an iPad, so you can use that for a device check, but isTablet only returns true if the UI is actually running like a tablet. I think that's fair enough.

    点赞 评论 复制链接分享