Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-23656

Windows: Implement Ti.Media.requestCameraPermissions/hasCameraPermissionsmethods to match iOS and Android behaviour

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 5.4.0
    • Fix Version/s: Release 6.0.0
    • Component/s: Windows
    • Labels:
    • Environment:

      Windows 10 Pro
      Appc CLI Core: 5.4.0-33
      Appc CLI NPM: 4.2.7
      Ti SDK: 5.3.0.GA,
      Appc Studio: 4.7.0.201607130543

    • Story Points:
      5
    • Sprint:
      2016 Sprint 16 SDK

      Description

      Description

      As part of TIMOB-19479 the media permissions was rewritten to be consistent across iOS and Android and use Ti.Media.requestCameraPermissions/hasCameraPermissions. Windows should move to match iOS and Android. A code sample can be found below

      function showCamera() {
              Titanium.Media.showCamera({
                  success : function(event) {
                      // called when media returned from the camera
                      Ti.API.debug('Photo taken successfully');
                  },
                  cancel : function() {
                      // called when user cancels taking a picture
                      Ti.API.debug('Photo cancelled.');
                  },
                  error : function(error) {
                      Ti.API.debug('Photo errored.');
                      // called when there's an error
                      var a = Titanium.UI.createAlertDialog({
                          title : "Camera"
                      });
                      a.setMessage(JSON.stringify(error));
                      a.show();
                  },
                  saveToPhotoGallery : true
              });
          }
          if (Ti.Media.hasCameraPermissions()) {
              showCamera();
          } else {
              Ti.Media.requestCameraPermissions(function(e) {
                  if (e.success === true) {
                      showCamera();
                  } else {
                      alert("Access denied, error: " + e.error);
                  }
              });
          }
      

      Steps to reproduce
      1. Run the code above on Windows Platform {{appc run -p windows }}
      Actual result

      The app will throw an error as the methods are not implemented

      Expected result

      You should be prompted to allow camera access

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                eharris Ewan Harris
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code