HackerNews icon indicating copy to clipboard operation
HackerNews copied to clipboard

Open Hacker News via intents from other apps

Open RAGETRON opened this issue 11 years ago • 13 comments

It would be nice if we could open the HN app for comment pages from other apps via the intent system. Example: when viewing search results in Google Now, clicking a result linking to a HN comment page should pop up Hacker News as a choice in the "Complete action using" dialog box. Clicking the choice should open the comments page on HN directly.

RAGETRON avatar Oct 31 '13 11:10 RAGETRON

This should also work for links inside the HN app itself. Currently, comment pages with links to other HN pages are asked to be open by other apps and HN is not on that list

RAGETRON avatar Oct 31 '13 12:10 RAGETRON

Please, Please add this. Here are a few links that claim to add this functionality http://appurl.org/docs/android http://stackoverflow.com/questions/5596261/intent-filter-to-launch-my-activity-when-custom-uri-is-clicked

antgiant avatar Nov 08 '13 19:11 antgiant

I tried adding the above to the Manifest then I got stuck as I am not an Android developer. https://github.com/antgiant/HackerNews/commit/d55ff8e8d30c327e539be0225a79c7bb7587f5f4

antgiant avatar Nov 08 '13 19:11 antgiant

I'll look into this shortly; I might not have a whole lot of time this week, but next week I certainly will.

pkillian avatar Nov 20 '13 02:11 pkillian

Thank you!

On Tuesday, November 19, 2013, Patrick Killian wrote:

I'll look into this shortly; I might not have a whole lot of time this week, but next week I certainly will.

— Reply to this email directly or view it on GitHubhttps://github.com/bishopmatthew/HackerNews/issues/31#issuecomment-28859426 .

Travis Wooley

antgiant avatar Nov 20 '13 11:11 antgiant

Thanks!

RAGETRON avatar Nov 21 '13 06:11 RAGETRON

Work started here: pkillian/HackerNews@793e21768e815c0b120325e2e7c235c6b5fae23e

This may be a bit tricky; it seems the most logical way of implementing this would be to create a function that can parse individual stories without adding them to a page, or tracking their position, and routing directly to the comments page for that individual story.

Currently, the application relies on the fact that all stories to be shown exist somewhere on the pages that you've scrolled down; e.g.: if you haven't scrolled and subsequently loaded anything other than just the front page, you can only view the comments of stories on the front page.

I'll be working on re-working this paradigm for the time being; however, the intent-filters are setup and working flawlessly: AndroidManifest.xml (Lines 27-46). I'll be thinking quite a bit about the best way of implementing the jump into a story, but I don't think there will be a clean way of doing it without ripping out too much previous code. If Matt has anything to suggest, I'll take his advice.

-pkill

pkillian avatar Nov 21 '13 07:11 pkillian

The problem, when I thought about doing this a while ago, is that the id parameter is overloaded on Hacker News. E.g. https://news.ycombinator.com/item?id=12345 could refer to the root of a story, or a link to a specific comment, and possibly a few other things that I can't remember.

We'd probably want to get the URL, parse it into a document with Jsoup, and then use some identifying features to figure out what type of page it is. Then we can route it to the comments page parser, or as a backup display it in a WebView.

I'll keep thinking about it, but if you want to try to go that route and have a question I'd be happy to help.

bishopmatthew avatar Nov 22 '13 06:11 bishopmatthew

Adding to milestone 3.0.0

pkillian avatar Jan 02 '14 21:01 pkillian

FYI, Ricky's HN Android app has got intents working https://play.google.com/store/apps/details?id=com.rickylaishram.hackernews

He also open sourced his app because lack of time: https://github.com/rickylaishram/Hacker-News-Android

Hopefully this helps getting intents working?

RAGETRON avatar May 22 '14 01:05 RAGETRON

I hoped to have a solution to this before starting work for the summer, but because of intellectual property issues, I can't contribute to the app under my current employment. Hopefully @bishopmatthew can pickup where I left off, or someone else? I'll accept pull requests if they come in and work to our liking, I just can't write the code myself.

pkillian avatar May 22 '14 03:05 pkillian

Please someone do this. I will donate money to compensate

azizLIGHT avatar Jan 09 '15 13:01 azizLIGHT

I found an example of how someone else did it. Is this helpful?

https://github.com/dinosaurwithakatana/hacker-news-android/commit/fdbe90e575ebda7fcf0570b5439639e6db38a655

azizLIGHT avatar Feb 06 '15 03:02 azizLIGHT