I'm trying to launch the Amazon Kindle app from my android application but based on a specific book that the user clicks.
I'm able to determine the books available and which book the user has selected but I have only been able to launch the kindle application (using the package name com.amazon.kindle) to launch the kindle app.
Does anyone know of any additional commands I can send to specify a book to open? I know this is possible as there is a widget on the google play store where the user selects a boo and it creates a button on the homescreen that launches the kindle app and opens the book.
Thanks in advance!
First we need to set the intent to an
ACTION_VIEW
intent.Then we need to define an
Uri
for the data which is actually a link that looks something like: kindle://book/?action=open&book_id=AMZNID0/B000FC1GHO/0/, where in this case the section B000FC1GHO corresponds to the ID of the book.Finally we can then start the activity. In my case I had to set some flags on the intent to launch a new activity.
The code I'm using is as follows:
I'm overriding the
onReceive
method in this case so that I can perform some additional steps on each book. Presumably because I'm just setting anACTION_VIEW
intent this could have been handles in the other class that does theonClickListener
for theimageview
that holds the book I want.