我正在开发一个Android帐户应用.现在我可以在Android中添加自己的帐户了.但是,当我打开"联系人"应用程序并切换到组寻呼机时,它会显示" 没有组.要创建组,您需要一个帐户. ".那么如何让android知道我的帐户可以添加一个组?
下面是我的xml文件:
AndroidManifest.xml中:
<!-- The sync service -->
<service
android:name="com.snail.android.sync.SyncService"
android:exported="true"
android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter"/>
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/contacts_sync_adapter"/>
<meta-data
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts"/>
</service>
Run Code Online (Sandbox Code Playgroud)
contacts.xml:
<?xml version="1.0" encoding="utf-8"?>
<ContactsAccountType>
<EditSchema>
<!--
Name:
- maxOccurs must be 1
- No types.
- Currently all the supportsXxx attributes must be true, but here's the plan for the
future:
(There's some hardcoded assumptions in the contact editor, which is one reason
for the above restriction)
- "Family name" and "Given name" must …Run Code Online (Sandbox Code Playgroud) 环境:节点 8.11.x 我想使用异步/等待睡眠一段时间。
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
await sleep(5000)
Run Code Online (Sandbox Code Playgroud)
这有效。
const sleep = util.promisify(setTimeout)
await sleep(5000)
Run Code Online (Sandbox Code Playgroud)
它会导致异常:TypeError: "callback" 参数必须是一个函数。 setTimeout文档说明:此方法具有可使用 util.promisify() 获得的 promise 的自定义变体
那么有什么区别呢?