android 賬戶管理和同步機制,android賬戶管理
在用的時候,發現建立了自己的獨立賬戶管理,同時在連絡人中,可以直接點擊發送資訊,查看朋友圈等功能,感覺挺方便了
然後就做了相關方面的調研,主要從兩個方面,進行了研究
1、帳號管理的是實現機制和同步實現方式
這個看:http://blog.csdn.net/swust_chenpeng/article/details/39401497
或者直接:http://blog.csdn.net/w2865673691/article/details/37403147
http://blog.csdn.net/u010002056/article/details/9210157
2、關於同步syncAdapter
這個主要參考sdk sample中的SampleSyncAdapter
匯入可能提示的錯誤:
Permission is only granted to system apps android.permission.WRITE_SECURE_SETTINGS
Window -> Preferences -> Android -> Lint Error Checking.
In the list find an entry with ID = ProtectedPermission. Set the Severity to something lower than Error. This way you can still compile the project using Eclipse.
http://stackoverflow.com/questions/13801984/permission-is-only-granted-to-system-app
http://blog.csdn.net/xjanker2/article/details/6146289
這裡最後提到上傳到gae時,可能提示moudle找不到:“其中遇到的一個model moudle找不到的問題需要你在model中建立一個__init__.py的空檔案,來說明是一個python模組,如果你也遇到此問題,希望對你有協助。”
但是這個工程必須的配合server端使用,而server端需要搭建在Google App Engine,所以就得先在gae上建立一個app,然後記住appId即可。這是由於samplesyncadapter_server端的代碼是基於python實現,所有我們去https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python下載Google App Engine SDK for Python下載下來進行解壓,關於它的使用,我們可以參考下:
http://blog.sina.com.cn/s/blog_bd0b53180101e9rw.html
http://lampeter123.iteye.com/blog/390536
http://www.qrong.com/archives/495
http://ego008.iteye.com/blog/554757
http://bbs.chinaunix.net/thread-1505938-1-1.html
感覺都差不多吧,隨便看個就行了,然後我們利用google_appengine目錄下(sdk的安裝目錄)的appcfg.py命令上傳服務端代碼到gae,命令:appcfg.py update \workspace\AuthenticatorActivity\samplesyncadapter_server\但是我這邊上傳的時候老提示出錯:appcfg.py:2416 An error occurred processing file '': HTTP Error 401: Unauthorized. Aborting.,不知道什麼原因,後來在appcfg.py後面加了個參數 --oauth2 ,具體原因不知道,可以看下:https://developers.google.com/appengine/docs/python/tools/uploadinganapp,上傳成功之後,我們再輸入:yourAppId/appspot..com我們sample syncadapter的頁面就出來了
然後在配合用戶端就可以用了
最後想要在連絡人中,點擊某個item,也能跳轉到指定的intent,我們可以再manifest.xml中進行配置:
<activity android:name=".authenticator.AuthenticatorActivity" android:label="@string/ui_activity_title" android:theme="@android:style/Theme.Dialog" android:excludeFromRecents="true" android:configChanges="orientation"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <data android:mimeType="vnd.android.cursor.item/vnd.samplesyncadapter.profile"/> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
一定要加<category/>標籤不然,連絡人裡面無法調用該intent,這時候點擊對應的mineType類型,就可以跳轉到對應的Activity
從age上同步下來的連絡人時唯讀 了,不知道怎麼回事???
圖中彈出的對話方塊是點擊View Profile彈出來的Activity(theme是dialog樣式的)
怎解除安卓智可以機中“帳戶與同步”中的管理帳戶
你說應該是Google帳號,退出或者登出賬戶就可以了
安卓手機關掉帳戶與同步裡的背景資料會怎?
沒什麼影響,一切功能正常使用
時間設定跟背景同步沒關係,只要把時間設定為了“自動擷取網路的值”就行。
如果你QQ已處於離線狀態,那就不會有訊息發來的,就相當於把QQ斷開了。隱藏行了,幹嘛離線呀。。
不過,據我所知,有些大型遊戲是需要開背景資料才能玩的,不過一般手機也帶不起來。放心好了