Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,739,156 Members 46,436 Now Online
XDA Developers Android and Mobile Development Forum

Playing with Otter Intents and Book Shortcuts

Tip us?
 
izomiac
Old
#1  
Junior Member - OP
Thanks Meter 11
Posts: 21
Join Date: Aug 2010
Default Playing with Otter Intents and Book Shortcuts

Unlike most, I've found myself actually liking the content-oriented otter launcher on stock. But, being a geek, I'm never satisfied so I was playing around with GoLauncher and ADW to see if I could get the best of both worlds. This is what I've uncovered so far.

To launch a specific part of Otter, such as the book library, you need to send the following type of intent:
Code:
Select Code
Action: com.amazon.kindle.otter.action.SHOW_BOOKS
Category: android.intent.category.HOME
The valid actions are:
Code:
Select Code
com.amazon.kindle.otter.action.SHOW_BOOKS
com.amazon.kindle.otter.action.SHOW_NEWS
com.amazon.kindle.otter.action.SHOW_APPS
com.amazon.kindle.otter.action.SHOW_DOCS
com.amazon.kindle.otter.action.SHOW_MUSIC
com.amazon.kindle.otter.action.SHOW_VIDEO
com.amazon.kindle.otter.action.SHOW_WEB
If you want to open a specific book, then you send an intent like this:
Code:
Select Code
Action: android.intent.action.VIEW
Data: kindle://book/?action=open&book_id=AMZNID0%2FB002WB0XW0%2F0%2F
All that you want to change in that data string is the escaped book_id field. '%2F' just means '/', so you can see it's really just 'AMZNID0/(Book ID)/0/'. You can extract the book's ID from any Amazon Kindle product page (go to Manage your Kindle on Amazon.com). So, the book ID in this example is: B002WB0XW0 and the URL of the product page is http://www.amazon.com/dp/B002WB0XW0 (plus some useless SEO keywords and tracking cruft I omitted).

Launching documents is very similar, but I assume each document's id is user specific. To see what it is, fire-up logcat ("adb logcat ActivityManager:D *:S") and look for a message like this:
Code:
Select Code
D/ActivityManager( 1452): Starting: Intent { act=android.intent.action.VIEW dat=
kindle://book/?action=open&book_id=AMZNID0%2FAEMEN728GNT2MXUF3VMENDMEY4SDV5AZ%2F
4%2F flg=0x10000000 cmp=com.amazon.kindle/.UpgradePage } from pid 3749
As for how to launch intents, several launchers let you do this. Sadly, Amazon gutted Settings.apk, so we're left with no provider for android.intent.action.pick_activity (ditto for shortcuts and folders). Therefore, we need an app like QCustomShortcut that will allow us to construct a custom intent shortcut, then directly add the icon to the launcher without going through the activities or shortcut menus. Sadly, that's not listed as compatible with the Fire, so you have to install it on another Android device and sideload the APK (which is kept under /mnt/asec, not /data/app, BTW).

In the end, I decided to return to Otter, but figured I could save someone a bit of trouble or hopefully even spark some ideas by posting this. It's all pretty basic stuff, but finding/launching intents and what-not took me a bit to sort through this evening so I suppose there may be others on this neophytic ledge between being a newb and a guru that I keep finding myself on.
The Following 6 Users Say Thank You to izomiac For This Useful Post: [ Click to Expand ]
 
fennecos
Old
#2  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Apr 2012
Hi izomiac,

I'm interested in what you said. I'm creating an android that can open any kind of documents, including ebooks.

Unfortunately I could not see the kind of information you show in my logcat.

You said :
Quote:
Launching documents is very similar, but I assume each document's id is user specific.
Could you give me an example to how open an ebook not downloaded by the amazon kindle app?

Really thank you for your post, it helps me a lot.
 
izomiac
Old
#3  
Junior Member - OP
Thanks Meter 11
Posts: 21
Join Date: Aug 2010
I don't think the Kindle app can directly open Documents/Books that haven't been downloaded. When I just tried that the Kindle App (for ICS) stayed on the splash screen and never loaded anything. I suspect Amazon uses some sort of push service rather than an intent to start an automatic download.

For logcat, what I did was run the logcat command using ADB, then launch the document I wanted to see the ID for on the Kindle using the stock launcher.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes