From dd9fbe86ff069c65b0f8af856b4c4ce27108933d Mon Sep 17 00:00:00 2001 From: Johan Lantz Date: Wed, 20 Jun 2018 14:54:30 +0200 Subject: [PATCH] manage android permissions --- lib/paramedic.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/paramedic.js b/lib/paramedic.js index a4947190..325ba569 100644 --- a/lib/paramedic.js +++ b/lib/paramedic.js @@ -244,6 +244,20 @@ ParamedicRunner.prototype.setPermissions = function () { paramediciOSPermissions.updatePermissions(applicationsToGrantPermission); } } + + if(this.config.getPlatformId() === util.ANDROID) { + var self = this; + self.server.on('jasmineStarted', function (data) { + logger.info('cordova-paramedic: Jasmine started'); + logger.warn('Requesting permissions'); + cp.exec("adb shell pm grant " + util.PARAMEDIC_DEFAULT_APP_NAME + " android.permission.READ_PHONE_STATE"); + cp.exec("adb shell pm grant " + util.PARAMEDIC_DEFAULT_APP_NAME + " android.permission.READ_SMS"); + cp.exec("adb shell pm grant " + util.PARAMEDIC_DEFAULT_APP_NAME + " android.permission.READ_CALL_LOG"); + cp.exec("adb shell pm grant " + util.PARAMEDIC_DEFAULT_APP_NAME + " android.permission.ACCESS_FINE_LOCATION"); + cp.exec("adb shell pm grant " + util.PARAMEDIC_DEFAULT_APP_NAME + " android.permission.ACCESS_COARSE_LOCATION"); + cp.exec("adb shell pm grant " + util.PARAMEDIC_DEFAULT_APP_NAME + " android.permission.RECORD_AUDIO"); + }); + } }; ParamedicRunner.prototype.injectReporters = function () {