Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13314

Plugin not detecting Windows version correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.4.1
    • None
    • cordova-plugin-camera
    • Windows 10 Mobile 10.0.14393 Emulator
      Windows 10 Mobile 10.0.14393 Microsoft Lumia 435
      Windows Universal Platform
      Windows Target Version: 8.1

    Description

      Whenever we run the plugin on a Windows 10 Mobile device, it will use the deprecated APIs and throw this warning:

      Warning

      The method Windows.Storage.Pickers.FileOpenPicker.pickSingleFileAndContinue has been deprecated. Instead, use PickSingleFileAsync

      This occurs because the plugin uses navigator.appVersion for version detection, but this only reports the target API, not the actual OS version. So the plugin thinks this is a Windows 8.1 phone while it's actually a Windows 10 phone.

      The navigator.appVersion is almost the same between the emulators and devices I've tried, only the Trident version is increased from 7 to 8 in Windows 10 Mobile:

      Emulator (WP8.1); Nokia Lumia 520 (WP8.1)

      5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; MSAppHost/2.0; rv:11.0; IEMobile/11.0; Microsoft; Virtual) like Gecko
      5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; MSAppHost/2.0; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like Gecko

      Emulator (10.0.14393); Microsoft Lumia 435 (10.0.14393.1715)

      5.0 (Windows Phone 8.1; ARM; Trident/8.0; Touch; MSAppHost/2.0; rv:11.0; IEMobile/11.0; Microsoft; Virtual) like Gecko
      5.0 (Windows Phone 8.1; ARM; Trident/8.0; Touch; MSAppHost/2.0; rv:11.0; IEMobile/11.0; Microsoft; Lumia 435) like Gecko
      10.0.14393.1715

      As long as the target API is WP8.1, the plugin will assume it is running on a WP 8.1 device.

      The only solution I found is to check device.version instead of navigator.appVersion, but this requires the device plugin. When device.version equals 6.x, it's a Windows Phone 8 device, when it's 10.x it is Windows 10 Mobile. I assume a PR that depends on the device plugin will be rejected, so I haven't created it.

      Targeting Windows 10 would make the app incompatible with all Windows Phone 8.x users, so that's not an option.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andreszs Andres Zsogon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: