cordova-screenshot icon indicating copy to clipboard operation
cordova-screenshot copied to clipboard

I got black image as screenshot in android 5+ Versions

Open thilife opened this issue 6 years ago • 1 comments

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

thilife avatar Aug 17 '17 05:08 thilife

get same here without crosswalk did you solve your problem ?

matrixreal avatar Apr 03 '18 17:04 matrixreal