Goodreads Developers discussion

60 views
questions > Android intent

Comments Showing 1-7 of 7 (7 new)    post a comment »
dateUp arrow    newest »

message 1: by Andrea (new)

Andrea (torakiki) | 4 comments Hi,
I have an Android app related to books. At some point in the app I show a link triggering a search on goodreads website with the book title as a query string. I would like to know if there is an Intent filter configured in the official Goodreads Android app that I can use to do something like:
Intent i = new Intent(Intent.ACTION_VIEW, "goodreads://search?q=title");

I couldn't find any info about it so I assume there is none but I'd like to have a confirmation and, if not available, is it planned in future releases?
Thanks
Andrea


message 2: by Robert (new)

Robert (lathanh) | 14 comments Hi Andrea,

I'm not sure whether our app will respond properly from an external Intent, but please try and let us know! We don't have an action URL scheme set up, but here's our SearchActivity's info:

App package: com.goodreads
Search Activity class: com.goodreads.android.activity.SearchActivity
Search string Intent Extra: "com.goodreads.search.string"

So your code would look something like this:

Intent intent = new Intent();
intent.setClassName("com.goodreads", "com.goodreads.android.activity.SearchActivity");
intent.putExtra("com.goodreads.search.string", title);

try {
activity.startActivityForResult(intent, activityCode);
} catch (ActivityNotFoundException e) {
// Goodreads app not installed
Toast.makeText(this, "Goodreads app not installed", Toast.LENGTH_LONG).show();
}



message 3: by Andrea (new)

Andrea (torakiki) | 4 comments Hi Robert,
thanks for your answer. I tested with the code you gave and I got a "java.lang.SecurityException: Permission Denial: starting Intent", I googled a bit and I found this:
http://developer.android.com/guide/to...

In short, if no intent-filter is configured for the activity the export attribute takes default value false and it cannot be called from outside your app, could it be the case?


message 4: by Robert (new)

Robert (lathanh) | 14 comments Yea, we don't have an intent filter for it. I'll see about adding it, but it won't be very soon and can't make an promises =/


message 5: by Andrea (new)

Andrea (torakiki) | 4 comments Sure, no problem, it's not blocking, I can trigger the search on the website, just.. on small screens the website is not very easy to use, that's why I thought it might be better to trigger the search on the App (where available).

Thanks
Andrea


message 6: by Robert (new)

Robert (lathanh) | 14 comments you could submit to the mobile version, which you may find to be a more appropriate experience: http://www.goodreads.com/m/book?searc...


message 7: by Andrea (new)

Andrea (torakiki) | 4 comments Perfect, I didn't know about the mobile version, thanks.


back to top