這是一個為 Android 程序開發的 OAuth 庫/應用,以便使用 Content Providers 來存儲 OAuth 數據。

示例代碼:

添加服務提供者

ContentValues values = new ContentValues(); 
values.put('request_token_url', '

getContentResolver().insert(Uri.parse('content://com.novoda.oauth.providers/registry'), values)</CODE></PRE>

重定向用戶到OAuth 激活

Intent intent = new Intent();
Bundle extras = new Bundle();
HashMap<String, String> value = new HashMap<String, String>();

intent.setAction("com.novoda.oauth.action.OAUTH_CALL"); intent.setData(Uri.parse("content://com.novoda.oauth.provider.OAuth/registry"), ID_OF_THE_SERVICE)); extras.putString("endpoint", ENDPOINT_URI); extras.putSerializable("parameters", value); intent.putExtras(extras);

startActivityForResult(intent, RESULT_CALLBACK_ID);</CODE></PRE>

<DIV class=date>收錄時間:2011-11-28 20:39:59</DIV>

 本文由用戶 碼頭工人自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!