在PhoneGap + ChildBrowser中集成Android + Twitter

时间:2011-09-09 13:34:19

标签: android twitter cordova

我已经在Android应用上成功集成了phonegap + childbrowser。现在我想在我的应用程序中集成twitter共享。我按照教程http://www.wisejive.com/2010/11/phonegap-jquery-mobile-twitter-and.html进行了操作 我以正确的方式完成了所有步骤,但我无法成功执行它。这是我从logcat的错误日志:

09-09 17:59:30.810: DEBUG/ChildBrowser(602): Hey I got a page started for url = http://compucloud.in/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_OAUTH_VERIFIER 
09-09 17:59:30.921: DEBUG/dalvikvm(602): GC_FOR_MALLOC freed 7717 objects / 506680 bytes in 90ms 
09-09 17:59:31.021: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/childbrowser.js: Line 51 : In _onEvent 
09-09 17:59:31.021: INFO/Web Console(602): In _onEvent at file:///android_asset/www/js/childbrowser.js:51 
09-09 17:59:31.091: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/childbrowser.js: Line 52 : data type = 1 
09-09 17:59:31.091: INFO/Web Console(602): data type = 1 at file:///android_asset/www/js/childbrowser.js:52 
09-09 17:59:31.101: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/childbrowser.js: Line 53 : url = http://compucloud.in/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_OAUTH_VERIFIER 
09-09 17:59:31.101: INFO/Web Console(602): url = http://compucloud.in/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_OAUTH_VERIFIER at file:///android_asset/www/js/childbrowser.js:53 
09-09 17:59:31.120: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/twHelper.js: Line 129 : this could be the req. thing : ----http://compucloud.in/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_OAUTH_VERIFIER ----] 
09-09 17:59:31.120: INFO/Web Console(602): this could be the req. thing : ----http://compucloud.in/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_OAUTH_VERIFIER ----] at file:///android_asset/www/js/twHelper.js:129 
09-09 17:59:31.131: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/twHelper.js: Line 130 : indexof value:__0__ 
09-09 17:59:31.131: INFO/Web Console(602): indexof value:__0__ at file:///android_asset/www/js/twHelper.js:130 
09-09 17:59:31.140: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/twHelper.js: Line 131 : Token Check: undefined 
09-09 17:59:31.140: INFO/Web Console(602): Token Check: undefined at file:///android_asset/www/js/twHelper.js:131 
09-09 17:59:31.490: DEBUG/PhoneGapLog(602): file:///android_asset/www/phonegap-1.0.0.js: Line 645 : Error in success callback: ChildBrowser2 = TypeError: Result of expression 'requestToken' [null] is not an object. 
09-09 17:59:31.490: INFO/Web Console(602): Error in success callback: ChildBrowser2 = TypeError: Result of expression 'requestToken' [null] is not an object. at file:///android_asset/www/phonegap-1.0.0.js:645 
09-09 17:59:31.660: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/childbrowser.js: Line 51 : In _onEvent 
09-09 17:59:31.660: INFO/Web Console(602): In _onEvent at file:///android_asset/www/js/childbrowser.js:51 
09-09 17:59:31.670: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/childbrowser.js: Line 52 : data type = 0 
09-09 17:59:31.670: INFO/Web Console(602): data type = 0 at file:///android_asset/www/js/childbrowser.js:52 
09-09 17:59:31.670: DEBUG/PhoneGapLog(602): file:///android_asset/www/js/childbrowser.js: Line 53 : url = undefined 
09-09 17:59:31.680: INFO/Web Console(602): url = undefined at file:///android_asset/www/js/childbrowser.js:53 

这些是我自定义生成的日志。我不能以某种方式从twitter获取请求令牌,因为它在过程中间返回错误。我对返回的错误一无所知。如果有人知道错误或之前已经这样做,请指导我。

提前致谢!

2 个答案:

答案 0 :(得分:1)

我已经能够使用ChildBrowser(几天前发布的版本)和bytespider的jsOAuth(在github上搜索)在我的android / phonegap应用程序中使用twitter。 jsOAuth自述文件附有底部附近示例的链接。

您引用的教程是为iOS编写的。您包含的日志输出没有多大帮助。

答案 1 :(得分:0)

感谢所有回复。实际上,我遵循的教程是针对iOS的,因为我找不到Twitter的内容。顺便说一句,我已经使用新的ChildBrowser http://simonmacdonald.blogspot.com/2011/09/phonegap-android-childbrowser-revamp.html完成了我的要求。

我将在大约一周内在我的博客上发布教程。请等一下。我会发布链接。感谢