提交 bdc77d3f 编写于 作者: L liushuling

appaccount资料修改

Signed-off-by: Nliushuling <liushuling1@huawei.com>
Change-Id: I25047d36fe0d798526a3c69d793802692b5c95d8
上级 3f4fa4bd
...@@ -198,18 +198,23 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void ...@@ -198,18 +198,23 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result)); console.log("result: " + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
bundleName: 'com.example.accountjsdemo',
action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log("startAbility err: " + JSON.stringify(err));
}); })
} }
try { try {
...@@ -252,18 +257,23 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, ...@@ -252,18 +257,23 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result)); console.log("result: " + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
bundleName: 'com.example.accountjsdemo',
action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log("startAbility err: " + JSON.stringify(err));
}); })
} }
let options = { let options = {
...@@ -1346,7 +1356,7 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi ...@@ -1346,7 +1356,7 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, authResult) { function onResultCallback(code, authResult) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
...@@ -1354,10 +1364,17 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi ...@@ -1354,10 +1364,17 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
console.log("startAbility err: " + JSON.stringify(err)); bundleName: 'com.example.accountjsdemo',
}); action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
})
} }
try { try {
...@@ -1402,7 +1419,7 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj ...@@ -1402,7 +1419,7 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, authResult) { function onResultCallback(code, authResult) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
...@@ -1410,10 +1427,17 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj ...@@ -1410,10 +1427,17 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
console.log("startAbility err: " + JSON.stringify(err)); bundleName: 'com.example.accountjsdemo',
}); action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
})
} }
let options = { let options = {
...@@ -2802,7 +2826,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -2802,7 +2826,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
...@@ -2810,10 +2834,17 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -2810,10 +2834,17 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err)=>{ deviceId: '',
bundleName: 'com.example.accountjsdemo',
action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log("startAbility err: " + JSON.stringify(err));
}); })
} }
appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, {
...@@ -3750,18 +3781,23 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri ...@@ -3750,18 +3781,23 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**示例:** **示例:**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result)); console.log("result: " + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err)=>{ deviceId: '',
console.log("startAbility err: " + JSON.stringify(err)); bundleName: 'com.example.accountjsdemo',
}); action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
})
} }
appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册