Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

I got black image as screenshot in android 5+ Versions #117

Open
thilife opened this issue Aug 17, 2017 · 1 comment
Open

I got black image as screenshot in android 5+ Versions #117

thilife opened this issue Aug 17, 2017 · 1 comment

Comments

@thilife
Copy link

thilife commented Aug 17, 2017

I got black image as screenshot in android 5+ Versions
screenshot_1502862106781

/* Cordova Screenshot Code*/

app.service('$cordovaScreenshot', ['$q', function ($q) {
return {
capture: function (filename, extension, quality) {
extension = extension || 'jpg';
quality = quality || '100';

        var defer = $q.defer();

        navigator.screenshot.save(function (error, res) {
            if (error) {
                console.error(error);
                defer.reject(error);
            } else {
                console.log('screenshot saved in: ', res.filePath);
                defer.resolve(res.filePath);
            }
        }, extension, quality, filename);
        return defer.promise;
    }
};

}]);

/* Social Sharing Code */

$scope.shareAnywhere = function () {
    $('.share_overlay').show();
    $cordovaScreenshot.capture()
     .then(function (result) {
         $cordovaSocialSharing.share(null, null, 'file://' + result, null).then(function (result) {
             $('.share_overlay').hide();
         }, function (err) {
             $('.share_overlay').hide();
             console.log("there was an error sharing!");
         });
     }, function (err) {
         $('.share_overlay').hide();
         console.log("there was an error taking a a screenshot!");
     });
}

I also used that crosswalk line

@matrixreal
Copy link

get same here without crosswalk
did you solve your problem ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants