mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-27 01:40:46 +00:00
js hap第一次打开,手动授权权限失败
Signed-off-by: wuxiaodan <wuxiaodan5@huawei.com>
This commit is contained in:
parent
692b4d77d1
commit
bd08cdcb6d
@ -12,11 +12,28 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {Core} from 'deccjsunit/index';
|
||||
import featureAbility from '@ohos.ability.featureAbility';
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('TestApplication onCreate');
|
||||
console.info('AceApplication onCreate');
|
||||
const core = Core.getInstance()
|
||||
core.init()
|
||||
const configService = core.getDefaultService('config')
|
||||
configService.setConfig(this)
|
||||
|
||||
console.info('Calc[IndexPage] grantPermission')
|
||||
let context = featureAbility.getContext()
|
||||
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser,'+result.requestCode)
|
||||
setTimeout(()=>{
|
||||
require('./test/List.test')
|
||||
core.execute()
|
||||
},1000)
|
||||
})
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('TestApplication onDestroy');
|
||||
console.info('AceApplication onDestroy');
|
||||
}
|
||||
};
|
||||
|
@ -26,23 +26,11 @@ export default {
|
||||
},
|
||||
onInit() {
|
||||
this.title = this.$t('strings.world');
|
||||
this.grantPermission();
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
onShow() {
|
||||
console.info('onShow finish')
|
||||
const core = Core.getInstance()
|
||||
core.init()
|
||||
require('../../test/List.test')
|
||||
core.execute()
|
||||
},
|
||||
onReady() {
|
||||
},
|
||||
grantPermission() {
|
||||
console.info(logTag + '[IndexPage] grantPermission')
|
||||
let context = featureAbility.getContext()
|
||||
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
|
||||
console.info(logTag + '[IndexPage] grantPermission,requestPermissionsFromUser,' + result.requestCode)
|
||||
},
|
||||
onReady() {
|
||||
},
|
||||
|
||||
})
|
||||
},
|
||||
}
|
||||
|
@ -12,11 +12,28 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {Core} from 'deccjsunit/index';
|
||||
import featureAbility from '@ohos.ability.featureAbility';
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('TestApplication onCreate');
|
||||
console.info('AceApplication onCreate');
|
||||
const core = Core.getInstance()
|
||||
core.init()
|
||||
const configService = core.getDefaultService('config')
|
||||
configService.setConfig(this)
|
||||
|
||||
console.info('Calc[IndexPage] grantPermission')
|
||||
let context = featureAbility.getContext()
|
||||
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser,'+result.requestCode)
|
||||
setTimeout(()=>{
|
||||
require('./test/List.test')
|
||||
core.execute()
|
||||
},1000)
|
||||
})
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('TestApplication onDestroy');
|
||||
console.info('AceApplication onDestroy');
|
||||
}
|
||||
};
|
||||
|
@ -20,14 +20,6 @@ export default {
|
||||
},
|
||||
|
||||
onInit() {
|
||||
this.grantPermission();
|
||||
},
|
||||
|
||||
grantPermission() {
|
||||
console.info('Calc[IndexPage] grantPermission')
|
||||
let context = featureAbility.getContext()
|
||||
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser,'+result.requestCode)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user