Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27731] Android: Camera fails to open when using saveToPhotoGallery: true

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2020-04-02T15:25:45.000+0000
Affected Version/sRelease 8.3.0, Release 8.3.1
Fix Version/sRelease 9.1.0
ComponentsAndroid
Labelsregression
ReporterEwan Harris
AssigneeGary Mathews
Created2020-01-22T21:41:36.000+0000
Updated2020-04-02T15:25:45.000+0000

Description

Description

When using the following code, the camera fails to open and I get the following error log. This looks to be a regression from 8.2.0.GA
[ERROR] TiMedia: (main) [122857,122924] Failed to create file: Permission denied
[DEBUG] DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@701a6fd[TiActivity]
[INFO]  { code: 2, error: 'Unable to create file for storage', success: false }
[INFO]  error, womp womp
const win = Ti.UI.createWindow();

win.addEventListener('click', _ => {
    Ti.Media.requestCameraPermissions(e => {
        if (!e.success) {
            console.warn('Failed to get permissions.');
            return;
        }
        Ti.Media.showCamera( {
            success(e) {
                console.log(e);
            },
            cancel(e) {
                console.warn(e);
            },
            error(e) {
                console.error(e);
            },
            saveToPhotoGallery: true,
            mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ]
        });
    })
});

win.open();

Steps to reproduce

1. Add the code above to an existing app.js 2. Build to Android

Actual

Above error log

Expected

Camera should open

Comments

  1. Ewan Harris 2020-01-22

    This looks to be the same as TIMOB-26273 but it works on 8.2.0.GA for me and is broken on 8.3.0.GA so filed a new ticket
  2. Yordan Banev 2020-02-13

  3. Gary Mathews 2020-02-21

    master: https://github.com/appcelerator/titanium_mobile/pull/11490
  4. Sohail Saddique 2020-03-23

    *FR: Pass* *Test Environment* SDK Ver: 8.3.1.GA & 9.0.0.GA & 9.1.0(this PR) OS Ver: 10.14.6 Appc NPM: 5.0.0 Appc CLI: 8.0.0 Daemon Ver: 3.2.0 Node Ver: 10.17.0 Java Ver: 1.8.0_162 Emulators: Android 5.1 (API 22) & Android 10 (API 29) PR merged.
  5. Samir Mohammed 2020-04-02

    *Closing ticket.* Fix verified in SDK version 9.1.0.v20200401121418. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11490

JSON Source