gitawego / cordova-screenshot

screenshot plugin for cordova/phonegap
Other
211 stars 168 forks source link

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

Open thilife opened 7 years ago

thilife commented 7 years ago

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 commented 6 years ago

get same here without crosswalk did you solve your problem ?