![](/img/trans.png)
[英]How to identify a local phone contact and an SYNC phone contact in android?
[英]android sync native contact into local db
問題是在我的onPerformSync方法中,我正在將本機聯系人同步到本地數據庫,但與此同時,如果用戶嘗試登錄,則屏幕凍結5分鍾。
誰能給我個主意,如何防止系統死機,或者如果不可能,那么我應該在哪里將本地聯系人同步到本地數據庫。
您可以為此使用IntentService。 我也為我的項目做了相同的功能。 這是希望能提供幫助的示例。
public class ManagePhoneContacts extends IntentService {
public ManagePhoneContacts()
{
super("ManageContactsService");
}
@Override
protected void onHandleIntent(Intent workIntent) {
getContacts();
}
private void getContacts()
{
//your code
}
}
//starting service where need to start
startService(new Intent(context, ManagePhoneContacts.class));
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.