Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-12-2010, 06:33 PM   #1
KukMan
Member
KukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with others
 
Posts: 12
Karma: 2600
Join Date: Oct 2010
Device: Kindle 3 Wi-fi US
Guide: How to write Kindlets

Big thanks for adq and his lj entries.
All what I'll write I tested on my Kindle 3 wifi only.
Your must have jailbreaked Kindle to do this, have some skills with Linux systems and with Java.
  1. First of all, we need get KDK jars files. You can copy it from your Kindle. Main KDK jar is located at /opt/amazon/ebook/lib/Kindlet-1.1.jar. Also you can pull off all jars from /opt/amazon/ebook/lib and /opt/amazon/ebook/sdk/lib folders.
  2. Create Java project in your fav IDE ( I use NetBeans ). Add Kindlet-1.1.jar as library to your project ( depends from your IDE ). Hello World Example Kindlet is under spoiler. You would be able to compile it at this step.

    Spoiler:
    Code:
    package test;
    
    
    import com.amazon.kindle.kindlet.AbstractKindlet;
    import com.amazon.kindle.kindlet.KindletContext;
    import com.amazon.kindle.kindlet.ui.KTextArea;
    
    public class Main  extends AbstractKindlet {
            
            private KindletContext ctx;
    
            public void create(KindletContext context) {
                    this.ctx = context;
            }
    
            public void start() {
                    try {
                            ctx.getRootContainer().add(new KTextArea("Hello World!"));
                    } catch (Throwable t) {
                            t.printStackTrace();
                    }
            }
    }
  3. You must change Manifest file in your project. It's depends from you IDE also. You must add this lines to it:
    Code:
    Implementation-Title: Your_App_Name
    Implementation-Version: Your_App_Verion
    Implementation-Vendor: Your_Name
    Don't forget change lines with your data.
    At this step, we have jar file with valid Manifest file. You can try change filename from *.jar to *.azw2, copy it into documents folder on USB mass storage and run, but you wouldn't be able do this. This is normal.
    Note, that you can check manifest, unzip jar file and see it in META-INF folder.
  4. Create own keystore with pairs of keys for signing own kindlets. "keytool" helps us. For creating keystore execute this commands:
    Code:
    keytool -genkeypair -keystore developer.keystore -storepass YOURPASS_FOR_STORE -keypass YOURPASS_FOR_KEY -alias dkYOUR_ALIAS -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
    keytool -genkeypair -keystore developer.keystore -storepass YOURPASS_FOR_STORE -keypass YOURPASS_FOR_KEY -alias diYOUR_ALIAS -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
    keytool -genkeypair -keystore developer.keystore -storepass YOURPASS_FOR_STORE -keypass YOURPASS_FOR_KEY -alias dnYOUR_ALIAS -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
    Note, that dk, di and dn suffixes in aliases is necessary.
    Alias is case-insensitive. For example:
    Code:
    keytool -genkeypair -keystore developer.keystore -storepass passwork -keypass password -alias dnTest -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
  5. Copy this keystore to /var/local/java/keystore/developer.keystore
  6. Sign jar file executing this command:
    Code:
    jarsigner -keystore KEYSTORE_FILE -storepass KEYSTORE_PASS JAR_FILE dkYOUR_ALIAS
    jarsigner -keystore KEYSTORE_FILE -storepass KEYSTORE_PASS JAR_FILE diYOUR_ALIAS
    jarsigner -keystore KEYSTORE_FILE -storepass KEYSTORE_PASS JAR_FILE dnYOUR_ALIAS
    For example:
    Code:
    jarsigner -keystore develop.keystore -storepass password ~/projects/test/dist/test.jar dnTest
  7. Copy signed jar into Kindle, rename it to *.azw2, and try to run.
    Note, that you must restart your Kindle after copying develop.keystore to it.

P.S. If you want to know more, you can read adq's entries in his LiveJournal about this.

P.S.S. I suggest create one public develop.keystore, and sign all free apps. It prevents problem with apps from different developers. Or how can I merge keystore from another developer with mine?

Last edited by KukMan; 10-12-2010 at 07:29 PM.
KukMan is offline   Reply With Quote
Old 10-13-2010, 01:15 AM   #2
neftaly
Junior Member
neftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with othersneftaly plays well with others
 
Posts: 8
Karma: 2600
Join Date: Oct 2010
Device: none
Thanks for writing this. I thought it might be a good idea to use the keystore that ADQ made with his first working app, "ktest":
-storepass password -keypass password -alias dktest/ditest/dntest
I've repackaged some of his files (K3 automatic key installer, jar signer script etc) and put them up at http://kindlebru.com/devkeys.zip. These should probably be fine for signing apps in the near future.

The manifest line Amazon-Cover-Image: logo.jpg will include a thumbnail (rel to the root of the jar archive). Thumbnails can be viewed by pressing the right donut button over the app. Full-colour jpeg and png images are supported, and are automatically scaled to approx 200x200 (official apps seem to use images closer to 500x500px).

For anybody else having trouble getting Kindlet jars off the device, I've also got them up at http://kindlebru.com/libs.zip (had trouble telnetting, so I just created an updater script with the command "cp -r /opt/amazon/ebook/lib/* /mnt/us/lib").

The manifest of one of the official Active Content apps has the line Network-Access-Grants: sponsored. Is this necessary to use 3G data?

Last edited by neftaly; 12-14-2010 at 08:00 PM.
neftaly is offline   Reply With Quote
Old 10-14-2010, 01:06 PM   #3
jozicka
Connoisseur
jozicka doesn't litterjozicka doesn't litter
 
Posts: 63
Karma: 194
Join Date: Feb 2010
Device: notebook
small question - how hard is to tranform any jar to azw2?

(something like opera.azw2 )
jozicka is offline   Reply With Quote
Old 10-14-2010, 03:26 PM   #4
KukMan
Member
KukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with othersKukMan plays well with others
 
Posts: 12
Karma: 2600
Join Date: Oct 2010
Device: Kindle 3 Wi-fi US
jar - is simple zip file and azw2 is simple zip file. It is significant what inside archive. You can't get opera mini for mobiles and run it on kindle. You need sources of midlet and change it to run on Kindle.
KukMan is offline   Reply With Quote
Old 11-23-2010, 06:28 PM   #5
kranu
I <3 my Kindle
kranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensions
 
Posts: 528
Karma: 51332
Join Date: Nov 2010
Location: United States
Device: Kindle 3G + WiFi
Gaaaah!

No matter how hard I try to follow this and ADQ's blog, I can't get it to show up on my Kindle! It compiles with no errors and what not.. and I've signed it and loaded the developer keys, but it does not show up on my Kindle screen. I've tried restarting multiple times too. The code is, as far as I can tell, very similar to ADQ's, which works perfectly on my Kindle.

I'm pretty new to Java, so it is probably something obvious that I am forgetting to do. If somebody could help me tell me what's wrong, I would be eternally grateful.
Attached Files
File Type: zip Hello World.zip (8.1 KB, 1204 views)
kranu is offline   Reply With Quote
Old 11-24-2010, 01:40 AM   #6
dvhh
Enthusiast
dvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with others
 
Posts: 27
Karma: 2600
Join Date: Nov 2010
Location: Osaka, Japan
Device: Kindle 3
what about modifying the policy files instead of setting dev key

I admit that this would be :
1. unsafe
2. not designed at all for "legitimate" application
3. should not be used by people who want to put their application on the amazon market later

But :
1. give access to all the jre object
2. allow the application to spawn some sub process (like using arecord command to record sound for example).
3. create a parallel market to the amazon one for application.
4. give dev more control over their platform.

However I admit that this is not safe at all, and you could end up fucking up your whole kindle.
dvhh is offline   Reply With Quote
Old 12-16-2010, 12:48 PM   #7
kindle3zeng
Enthusiast
kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.
 
Posts: 35
Karma: 1566
Join Date: Nov 2010
Device: kindle 3wifi
Quote:
Originally Posted by kranu View Post
Gaaaah!

No matter how hard I try to follow this and ADQ's blog, I can't get it to show up on my Kindle! It compiles with no errors and what not.. and I've signed it and loaded the developer keys, but it does not show up on my Kindle screen. I've tried restarting multiple times too. The code is, as far as I can tell, very similar to ADQ's, which works perfectly on my Kindle.

I'm pretty new to Java, so it is probably something obvious that I am forgetting to do. If somebody could help me tell me what's wrong, I would be eternally grateful.
I'm new to java also, but I just managed to get my first kindlet run.

I took a look at your package, I'm not sure what tool you used to package it. But I used ellipse, and exported it as a jar file, using a manifest file:

Code:
Manifest-Version: 1.0
Description: Test for Kindle
Main-Class: test.Main
Implementation-Title: Hello
Implementation-Version: 0.0.1
Implementation-Vendor: Me
At first, I didn't include
Code:
Description: Test for Kindle
Main-Class: test.Main
which caused my kindlet not to show up.

With these lines added, it ran like a charm.
Attached Thumbnails
Click image for larger version

Name:	screen_shot-22996.gif
Views:	3063
Size:	3.2 KB
ID:	62896  
kindle3zeng is offline   Reply With Quote
Old 12-17-2010, 02:08 AM   #8
kranu
I <3 my Kindle
kranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensions
 
Posts: 528
Karma: 51332
Join Date: Nov 2010
Location: United States
Device: Kindle 3G + WiFi
Quote:
Originally Posted by kindle3zeng View Post
I'm new to java also, but I just managed to get my first kindlet run.

I took a look at your package, I'm not sure what tool you used to package it. But I used ellipse, and exported it as a jar file, using a manifest file:

Code:
Manifest-Version: 1.0
Description: Test for Kindle
Main-Class: test.Main
Implementation-Title: Hello
Implementation-Version: 0.0.1
Implementation-Vendor: Me
At first, I didn't include
Code:
Description: Test for Kindle
Main-Class: test.Main
which caused my kindlet not to show up.

With these lines added, it ran like a charm.
Well, I already had the Main-Class line, but I added the description line, and the Kindlet magically appeared on my screen! I'm not sure why this happened, because when I removed the line from my code and reuploaded, the Kindlet did not disappear.

I suspect that the problem could have been with the fact that I was using the 64-bit eclipse, but I compiled this one with 32-bit eclipse. Unfortunately, I have no way of checking because I wiped out my computer, but thanks for your help! Now I can finally try some developing
kranu is offline   Reply With Quote
Old 12-21-2010, 05:39 AM   #9
dvhh
Enthusiast
dvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with others
 
Posts: 27
Karma: 2600
Join Date: Nov 2010
Location: Osaka, Japan
Device: Kindle 3
I slightly updated the example to make a little bit more usefull notepad

Made it read a buffer.txt at start for recovery, and write it back before stopping.
Tried to fiddle with the anti aliasing, but the speed impact is really too strong, and the "symbole" window position is an issue if you type long text.
Oh and no scroll bars yet.

it also learned me that alt+del remove the whole field content.
source are provided as I don't have any rights on them, and as usual use at your own risk.
Attached Files
File Type: bz2 kapp.tar.bz2 (1.01 MB, 1357 views)
dvhh is offline   Reply With Quote
Old 12-26-2010, 03:07 PM   #10
dvhh
Enthusiast
dvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with others
 
Posts: 27
Karma: 2600
Join Date: Nov 2010
Location: Osaka, Japan
Device: Kindle 3
New hints
http://blog.tkxuyen.com/2010/10/kind...g-and-kdk.html
which goes
http://apetresc.wordpress.com/2010/07/03/kindle-goban/
https://github.com/apetresc/KindleGoban
https://github.com/apetresc/KindleChess

these code are suppose to work under the simulator
dvhh is offline   Reply With Quote
Old 12-26-2010, 10:04 PM   #11
dvhh
Enthusiast
dvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with othersdvhh plays well with others
 
Posts: 27
Karma: 2600
Join Date: Nov 2010
Location: Osaka, Japan
Device: Kindle 3
We are Still missing the piece where we could load resources from the jar, I'm thinking of going around it by pre-processing the resources to convert them into java byte arrays.
dvhh is offline   Reply With Quote
Old 12-28-2010, 05:32 PM   #12
apetresc
Junior Member
apetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with others
 
Posts: 6
Karma: 2600
Join Date: Dec 2010
Device: Kindle DX
Hey guys; I'm the author of KindleGoban, KindleChess, and Kindle Widget Toolkit (KWT). Let me know if you guys have any questions about building or running any of those. I've only had experience going through the KDK, not the jailbreak, but I'll do my best if problems come up with anything I did.

Cheers!
-Adrian
apetresc is offline   Reply With Quote
Old 12-29-2010, 05:26 PM   #13
kindle3zeng
Enthusiast
kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.
 
Posts: 35
Karma: 1566
Join Date: Nov 2010
Device: kindle 3wifi
Quote:
Originally Posted by apetresc View Post
Hey guys; I'm the author of KindleGoban, KindleChess, and Kindle Widget Toolkit (KWT). Let me know if you guys have any questions about building or running any of those. I've only had experience going through the KDK, not the jailbreak, but I'll do my best if problems come up with anything I did.

Cheers!
-Adrian
Hey, Adrian. Thanks for your great work, I looked KWT, it is really cool.

What I need is an example for multi-page display, I could not figure out how to do that, I've heard that there was an example in KDK, but I don't have that, so could you give me an example/hint on that?
kindle3zeng is offline   Reply With Quote
Old 12-30-2010, 03:58 AM   #14
azit
Member
azit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with others
 
Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
Hi Adrian,
Quote:
Originally Posted by apetresc View Post
Hey guys; I'm the author of KindleGoban, KindleChess, and Kindle Widget Toolkit (KWT). Let me know if you guys have any questions about building or running any of those. I've only had experience going through the KDK, not the jailbreak, but I'll do my best if problems come up with anything I did
I've managed to compile your KindleChess to run on a jailbroken kindle 3. I reduced the square size to 64x64 so it would fit on the screen, as it appears you originally wrote it for a dx. I then created 64x64 images for the pieces. It's a bit of a mess as I've only spent a couple of hours on it and I have to figure out how to debug it. Since I don't have a simulator I can only run it on the kindle which is a bit of a pain. Progress so far attached.

Edit. Now working, but with some refresh issues at startup. Seems the board isn't all displayed, perhaps because the images haven't been read in in time? Just got to fix the grey scale background for black.

Cheers,
Paul
Attached Thumbnails
Click image for larger version

Name:	ch3.gif
Views:	1865
Size:	23.5 KB
ID:	63784  

Last edited by azit; 12-30-2010 at 09:47 AM.
azit is offline   Reply With Quote
Old 12-31-2010, 12:46 AM   #15
apetresc
Junior Member
apetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with othersapetresc plays well with others
 
Posts: 6
Karma: 2600
Join Date: Dec 2010
Device: Kindle DX
Quote:
Originally Posted by kindle3zeng View Post
Hey, Adrian. Thanks for your great work, I looked KWT, it is really cool.

What I need is an example for multi-page display, I could not figure out how to do that, I've heard that there was an example in KDK, but I don't have that, so could you give me an example/hint on that?
Hey kindle3zeng. Glad to get some feedback

The sample code for multi-page displays in the KDK (SamplePagedData) is known to be broken, several people on the developer forums have reported it. I did manage to get it working on my own though -- I have a really simple multi-page display in KindleGoban; check out line 160 of Main.java (that app is in the middle of a major refactoring, sorry about the mess )

Let me know if that's enough of an example, or if you have specific questions about something that's not working.

Cheers!
-Adrian
apetresc is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write Kindlets? nathansuchy Kindle Developer's Corner 3 11-17-2012 04:16 PM
Kindlets crashing ger1972 Kindle Developer's Corner 8 06-28-2012 11:26 PM
Developing kindlets on the K4 NT ger1972 Kindle Developer's Corner 10 06-15-2012 11:45 AM
List of Kindlets available inameiname Kindle Developer's Corner 27 04-14-2012 07:16 AM
iLiad jharker:would you please write a guide on installing iLiadPowerManagement tudou331100 iRex Developer's Corner 10 01-22-2009 11:19 PM


All times are GMT -4. The time now is 09:13 AM.


MobileRead.com is a privately owned, operated and funded community.