如何制作像 Google IO 2011 这样的实时 Twitterfeed 应用程序?

发布于 2024-11-05 10:53:04 字数 889 浏览 1 评论 0 原文

我不知道您是否已经测试过 Google IO 应用程序,但有一个很酷的功能,可以显示包括 Google IO 主题标签在内的所有推文。

我真的很想为我的用户提供相同的功能。

我可以使用 API 做类似的事情,但我必须创建一个自定义列表视图,解析 XML/JSON 提要,这非常复杂! 当然,这个列表不会自动更新并且是实时推送

在应用程序中,我刚刚看到,当我关闭wifi时,这确实是一个具有以下网址的网络视图:

http://www.google.com/search?%20tbs=mbl%3A1&hl =en&source=hp&biw=1170&bih=668&q=%23io2011&btnG=Search

这是应用程序的屏幕截图和浏览器中的相同网址

高分辨率图片:http://cl.ly/3q1r0c2J3H163E3G2p2X

嗨分辨率,点击这里

但是在网络视图中使用此网址仅显示谷歌搜索,并且不提供相同的功能。

我知道这个应用程序肯定会开源,但我对谷歌承诺的“未来几天内”非常持否定态度。 我们仍在等待 Twitter 应用程序源代码!

I don't know if you already tested the Google IO application, but there is a cool feature displaying all the tweets including Google IO hashtags.

I really would like to offer the same feature to my users.

I can do something similar using the API, but I would have to create a custom listview, parsing XML/JSON feeds and that's quite overcomplicated! and of course this list will not update automatically and be a livefeed.

In the application, I have just seen that when I turn off wifi, This is indeed a webview with this url:

http://www.google.com/search?%20tbs=mbl%3A1&hl=en&source=hp&biw=1170&bih=668&q=%23io2011&btnG=Search

Here is a screenshot of the app and the same url in the browser

High resolution picture: http://cl.ly/3q1r0c2J3H163E3G2p2X

Hi resolution, click Here

But using this url in a webview display only a google search, and does not offer same feature.

I know this app will certainly be opensources, but i am so negative about "within next days" that google promise.
We are still waiting for the Twitter app source code!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风情万种。 2024-11-12 10:53:04

如果您等到会议结束后,您将在此处。您还可以在那里找到去年应用程序的源代码。

更新:

刚刚查看了源代码,你几乎是对的。这是一个具有以下网址的网络视图:http://www.google.com/search?tbs=mbl%3A1&hl=en&source=hp&biw=1170&bih=668&q=%23io2011&btnG=Search 所以看起来你可能不小心把 %20 放​​在那里了。

代码:

public static final String EXTRA_QUERY = "com.google.android.iosched.extra.QUERY";

public static final String CONFERENCE_HASHTAG = "#io2011";

private String mSearchString;

//onCreate()
final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
mSearchString = intent.getStringExtra(EXTRA_QUERY);
if (TextUtils.isEmpty(mSearchString)) {
    mSearchString = CONFERENCE_HASHTAG;
}
if (!mSearchString.startsWith("#")) {
    mSearchString = "#" + mSearchString;
}

//onCreateView
mWebView = (WebView) root.findViewById(R.id.webview);

mWebView.post(new Runnable() {
    public void run() {
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
        try {
            mWebView.loadUrl(
                    "http://www.google.com/search?tbs="
                    + "mbl%3A1&hl=en&source=hp&biw=1170&bih=668&q="
                    + URLEncoder.encode(mSearchString, "UTF-8")
                    + "&btnG=Search");
        } catch (UnsupportedEncodingException e) {
            Log.e(TAG, "Could not construct the realtime search URL", e);
        }
    }
});

If you wait 'til after the conference is over, you'll find the source code for the app here. You'll also find last year's application's source code there.

Update:

Just viewed the source code, and you're almost right. It's a webview with this URL: http://www.google.com/search?tbs=mbl%3A1&hl=en&source=hp&biw=1170&bih=668&q=%23io2011&btnG=Search so it just seems you put %20 in there by accident maybe.

Code:

public static final String EXTRA_QUERY = "com.google.android.iosched.extra.QUERY";

public static final String CONFERENCE_HASHTAG = "#io2011";

private String mSearchString;

//onCreate()
final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
mSearchString = intent.getStringExtra(EXTRA_QUERY);
if (TextUtils.isEmpty(mSearchString)) {
    mSearchString = CONFERENCE_HASHTAG;
}
if (!mSearchString.startsWith("#")) {
    mSearchString = "#" + mSearchString;
}

//onCreateView
mWebView = (WebView) root.findViewById(R.id.webview);

mWebView.post(new Runnable() {
    public void run() {
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
        try {
            mWebView.loadUrl(
                    "http://www.google.com/search?tbs="
                    + "mbl%3A1&hl=en&source=hp&biw=1170&bih=668&q="
                    + URLEncoder.encode(mSearchString, "UTF-8")
                    + "&btnG=Search");
        } catch (UnsupportedEncodingException e) {
            Log.e(TAG, "Could not construct the realtime search URL", e);
        }
    }
});
屋檐 2024-11-12 10:53:04

可能是通过带有限制的 Loaders API 实现的。
也在焦急地等待源码。

Probably implemented with Loaders API with throttling.
Impatiently waiting for source code as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文