tag:blogger.com,1999:blog-45269992732164662712024-02-22T09:35:55.225+01:00My Android cornerRandom things related to android development.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-4526999273216466271.post-9286960713858279412010-09-07T20:05:00.000+02:002010-09-07T20:05:58.064+02:00Starting Android applications from shellStarting application from the shell can be helpful in many scenarios. On scenario is when you want to limit the resources that the application is going to use with <b>ulimit</b>.<br />
1. Start the shell.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/TIUMP-z0mSI/AAAAAAAAAJw/TQrM7wRK4_A/s1600/Start+Android+shell.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/TIUMP-z0mSI/AAAAAAAAAJw/TQrM7wRK4_A/s320/Start+Android+shell.png" /></a></div><br />
2. Start the ActivityManager(am) command-line tool with appropriate parameters.<br />
The syntax for the am command-line tool is the following.<br />
ssue am command. am command syntax is as follow :<br />
am [start|instrument]<br />
am start [-a <action>] [-d ] [-t <mime_type>]<br />
[-c <category> [-c <category>] ...]<br />
[-e <extra_key> <extra_value> [-e <extra_key> <extra_value> ...]<br />
[-n <component>] [-D] [<uri>]<br />
am instrument [-e <arg_name> <arg_value>] [-p <prof_file>]<br />
[-w] <component><br />
<br />
<br />
3. Start the web browser with the following command.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/TIVJ3uD02ZI/AAAAAAAAAKA/m7HILGgxdqI/s1600/start+browser.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="15" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/TIVJ3uD02ZI/AAAAAAAAAKA/m7HILGgxdqI/s400/start+browser.png" width="400" /></a></div><br />
am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/TIURRg88nII/AAAAAAAAAJ4/GuR9DUZQJRk/s1600/browser.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/TIURRg88nII/AAAAAAAAAJ4/GuR9DUZQJRk/s320/browser.png" /></a></div>to start your own application just type:<br />
am start -a android.intent.action.MAIN -n "Your Package"/."Your Activity"<br />
If you hare unsure of what your package and main activity are look in your manifest file:<br />
<br />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"<br />
<b> package="com.TordSoft.HelloWorld"</b>><br />
<application android:icon="@drawable/icon"><br />
<<b>android:name=".HelloWorld"</b> android:label="@string/app_name"><br />
<intent-filter><br />
<action android:value="android.intent.action.MAIN" /><br />
<category android:value="android.intent.category.LAUNCHER" /> </intent-filter><br />
</activity></application>..</manifest>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com6tag:blogger.com,1999:blog-4526999273216466271.post-41279342743262957112009-10-25T13:41:00.005+01:002009-10-25T13:49:08.024+01:00NeoDatis Benchmark on Android<div><div>After doing a lot of different testing and trying a lot of different settings I finally decided to do some testing. I had some heap size memory when doing the complete TestIndex test with all of the 10000 records, NeoDatis like to store all of entries in it's internal cache, so I settled with 1000 for now, until I can figure out a way to get around the memory related issues. <br />
</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SuQvdzTMuMI/AAAAAAAAAFc/kDR9HTOv_vQ/s1600-h/neodatis.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SuQvdzTMuMI/AAAAAAAAAFc/kDR9HTOv_vQ/s320/neodatis.png" vr="true" /></a><br />
</div>Here are the result table:<br />
<center><br />
<table border="1" style="border-bottom: 1px; border-collapse: collapse; border-left: 1px; border-right: 1px; border-top: 1px; text-align: center;"><tbody>
<tr><td></td><td>Perst<br />
</td><td>SQLite<br />
</td><td>DB4O<br />
</td><td>BerkeleyDB<br />
</td><td>NeoDatis<br />
</td></tr>
<tr><td>Insert<br />
</td><td>1159<br />
</td><td>6892<br />
</td><td>4168<br />
</td><td>4619<br />
</td><td>25022<br />
</td></tr>
<tr><td>Search<br />
</td><td>599<br />
</td><td>9481<br />
</td><td>18261<br />
</td><td>3405<br />
</td><td>18325<br />
</td></tr>
<tr><td>Iterate<br />
</td><td>120<br />
</td><td>290<br />
</td><td>4392<br />
</td><td>2889<br />
</td><td>11126<br />
</td></tr>
<tr><td>Delete<br />
</td><td>1659<br />
</td><td>6315<br />
</td><td>7084<br />
</td><td>5565<br />
</td><td>10156<br />
</td></tr>
</tbody></table></center></div>It should be noted that the NeoDatis team releases new versions often, so if you have some problem, it might be fixed in a new version.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com8tag:blogger.com,1999:blog-4526999273216466271.post-31093795119167752592009-10-14T23:05:00.000+02:002009-10-14T23:05:46.446+02:00NeoDatis on Android introI've been playing around with NeoDatis a little while now so I thought I'd write a little intro post on it before I did the testing.<br />
NeoDatis ODB like a lot of the other database management system (DBMS)'s that I've tested lately can be used as both an an embedded database engine or in client/server mode.<br />
<b>Size</b><br />
The makers of NeoDatis say that ODB runtime is less than 550k, witch would make it quite suitable for use on android. In the some time soon I'll do some heap usage tests to see how much heap the different DBMS's use while running, just need a tool to do it, worst case I'll write it myself.<br />
<b>Features</b><br />
It supports ACID transactions to insure data integrity, it also has a automatic transaction recovery that runs in the startup sequence that will commit the records in case of a "fatal" shutdown due to an unexpected event such as a hardware failure.<br />
<div><b>Storage<br />
</b>NeoDatis ODB uses a single file to store all it's data:<br />
<ul><li>The Meta-model</li>
<li>The objects</li>
<li>The indexes</li>
</ul><b></b><br />
<b><div>NB:<span style="font-weight: normal;"> How ever you should be aware of a few things before starting using the NeoDatis.</span><br />
</div><div><span style="font-weight: normal;">The file that you are going to use for the database, must not be a new empty file. If you give NeoDatis a empty file, it will crash and give you an exception looking something like this:</span><br />
<pre>Version=1.9.17 , Build=632, Date=03-10-2009-05-38-18, Thread=Thread-8
NeoDatisError:276:End Of File reached - position = 0 : Length = 0
StackTrace: org.neodatis.odb.impl.core.layers.layer3.buffer.MultiBufferedIO.manageBufferForNewPosition(MultiBufferedIO.java:151)
org.neodatis.odb.impl.core.layers.layer3.buffer.MultiBufferedIO.setCurrentReadPosition(MultiBufferedIO.java:271)
org.neodatis.odb.core.layers.layer3.engine.FileSystemInterface.setReadPosition(FileSystemInterface.java:202)
org.neodatis.odb.impl.core.layers.layer3.engine.ObjectReader.readEncryptionFlag(ObjectReader.java:180)
org.neodatis.odb.impl.core.layers.layer3.engine.ObjectReader.readDatabaseHeader(ObjectReader.java:244)
org.neodatis.odb.core.layers.layer3.engine.AbstractStorageEngine.init(AbstractStorageEngine.java:206)
org.neodatis.odb.core.layers.layer3.engine.AbstractStorageEngine.<init>(AbstractStorageEngine.java:171)
org.neodatis.odb.impl.core.layers.layer3.engine.LocalStorageEngine.<init>(LocalStorageEngine.java:18)
org.neodatis.odb.impl.DefaultCoreProvider.getClientStorageEngine(DefaultCoreProvider.java:140)
org.neodatis.odb.impl.main.LocalODB.<init>(LocalODB.java:49)
org.neodatis.odb.impl.main.LocalODB.getInstance(LocalODB.java:35)
org.neodatis.odb.ODBFactory.open(ODBFactory.java:72)
</init></init></init></pre></div><div><span class="Apple-style-span" style="font-weight: normal;">I've submitted it as a <a href="https://sourceforge.net/tracker/?func=detail&atid=887885&aid=2879116&group_id=179124">bug</a>, and got a reply pretty fast so It will probably be fixed or documented soon. </span><br />
</div></b><b>Thread safety</b><br />
NeoDatis ODB supports usage in a multi-threaded environment.<br />
<br />
<b>Import/Export</b><br />
ODB lets you export & import all data to XML.<br />
<br />
<b>Refactoring</b><br />
</div><div><b></b>An interesting feature that I haven't seen before. You can add and remove fields without problems, it allso support additional refactoring through through it's Object Explorer(Extra app) where you can rename classes and fields.<br />
<br />
</div><div><b>Licence<br />
</b>ODB is distributed under the LGPL license.<br />
<br />
So this was a quick introduction, at the moment I'm working on a TestIndex for it which should be done soon. If you want to know more about NeoDatis I suggest their <a href="http://www.neodatis.org/">homepage </a>which has pretty good documentation.<br />
</div>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com1tag:blogger.com,1999:blog-4526999273216466271.post-19902924658435469192009-10-11T23:53:00.000+02:002009-10-11T23:53:49.995+02:00JODB (Java Objects Database) for Android (3) with reduced TestIndex benchmark<div>While creating and running the TestIndex for JODB I've discovered a few things.<br />
</div><div><ul><li>Search operations are slow, and scale with the amount of records that is present in the database, so if it tok 2 seconds to get 10 distinct records with 100 records it will take 200 seconds with 10000, which are the number of records currently used in the TestIndex test. So large record-sets are not a good idea.</li>
<li>It seems to use a very little amount of memory, but when searching goes as it goes, that doesn't really help that much when things take as much time as it does.</li>
<li>As mentioned before it only supports primitives as indexes, so one really can't do a full TestIndex test.</li>
</ul><div>As search operations was so costly I though I run a very reduced test with <i><b>100 </b></i>records just to see how all of the other database management systems (DBMS).<br />
</div><div><br />
</div></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/StIYfFe6CdI/AAAAAAAAAFU/tw9HY3wWTAU/s1600-h/jodb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/StIYfFe6CdI/AAAAAAAAAFU/tw9HY3wWTAU/s320/jodb.png" /></a><br />
</div><div class="separator" style="clear: both; text-align: center;">As we see search operations are costly, my guess to why they are so costly is the way that JODB interacts with files on the system. I think that it do a lot of input/output (IO) operations when it does it's search operations. From what I gathered from looking in the source code it uses a FileChannel object to access its database files, which just reads or writes on a specific part of a file. So when doing a search operation it will read through the file until it finds the "part" (Record) that we are interested in. This would also explain why it use so little memory when it is running.<br />
</div><br />
<center><br />
<br />
<table border="1"><tbody>
<tr><td style="text-align: center;"></td><td><div style="text-align: center;">Perst<br />
</div></td><td><div style="text-align: center;">SQLite<br />
</div></td><td><div style="text-align: center;">DB4O<br />
</div></td><td><div style="text-align: center;">BerkeleyDB<br />
</div></td><td><div style="text-align: center;">JODB<br />
</div></td></tr>
<tr><td><div style="text-align: center;">Insert<br />
</div></td><td><div style="text-align: center;">106<br />
</div></td><td><div style="text-align: center;">586<br />
</div></td><td><div style="text-align: center;">278<br />
</div></td><td><div style="text-align: center;">354<br />
</div></td><td><div style="text-align: center;">2183<br />
</div></td></tr>
<tr><td><div style="text-align: center;">Search<br />
</div></td><td><div style="text-align: center;">48<br />
</div></td><td><div style="text-align: center;">889<br />
</div></td><td><div style="text-align: center;">989<br />
</div></td><td><div style="text-align: center;">334<br />
</div></td><td><div style="text-align: center;">31021<br />
</div></td></tr>
<tr><td><div style="text-align: center;">Iterate<br />
</div></td><td><div style="text-align: center;">14<br />
</div></td><td><div style="text-align: center;">36<br />
</div></td><td><div style="text-align: center;">238<br />
</div></td><td><div style="text-align: center;">192<br />
</div></td><td><div style="text-align: center;">718<br />
</div></td></tr>
<tr><td><div style="text-align: center;">Delete<br />
</div></td><td><div style="text-align: center;">115<br />
</div></td><td><div style="text-align: center;">498<br />
</div></td><td><div style="text-align: center;">415<br />
</div></td><td><div style="text-align: center;">465<br />
</div></td><td><div style="text-align: center;">1011<br />
</div></td></tr>
</tbody></table><br />
</center>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com3tag:blogger.com,1999:blog-4526999273216466271.post-34241555775253817352009-10-11T00:35:00.000+02:002009-10-11T00:35:27.517+02:00JODB (Java Objects Database) for Android (2)After my previous <a href="http://tordtech.blogspot.com/2009/10/jodb-java-objects-database-for-android.html">post</a> on JODB and after using it for a while I discovered a couple of things about JODB. JODB is picky of what it allows you to use as an Index. It will only allow you to use primitives as an index, so if you try to use something that is not a primitive, such as a string:<br />
<br />
db.configureIndex(Record.class, "strKey", true); won't work.<br />
<br />
You will get an exception looking something like this: <br />
<pre>com.mobixess.jodb.core.JodbIOException: can't find description for primitive java.lang.String
com.mobixess.jodb.util.PrimitiveJavaTypesUtil.getEnumeratedType(PrimitiveJavaTypesUtil.java:141)
com.mobixess.jodb.core.index.JODBIndexingAgent.<init></init>(JODBIndexingAgent.java:73)
com.mobixess.jodb.core.index.JODBIndexingRootAgent.addAgent(JODBIndexingRootAgent.java:148)
com.mobixess.jodb.core.index.JODBIndexingRootAgent.enableIndex(JODBIndexingRootAgent.java:72)
com.mobixess.jodb.core.JODBSessionContainer.configureIndex(JODBSessionContainer.java:130)
com.mobixess.jodb.core.JODBSessionContainer.configureIndex(JODBSessionContainer.java:102)
</pre><br />
Another thing you must watch out for is when you are deleting your object from the database, you should(must at least when they contain other stuff than primitives) deactivate them, before, deleting them. <br />
<pre>Record r = set.next();
db.deactivate(r, 1);
db.delete(r);
</pre>If you do not do this you will get an exception from deep within the Apache harmoney classes, in mmap method.<br />
<pre>java.io.IOException
org.apache.harmony.luni.platform.OSMemory.mmap(OSMemory.java:617)
org.apache.harmony.luni.platform.PlatformAddressFactory.allocMapPlatformAddressFactory.java:107)
org.apache.harmony.nio.internal.FileChannelImpl.mapImpl(FileChannelImpl.java:201)
org.apache.harmony.nio.internal.ReadWriteFileChannel.map(ReadWriteFileChannel.java:53)
org.apache.harmony.nio.internal.FileChannelImpl.transferFrom(FileChannelImpl.java:422)
com.mobixess.jodb.core.io.buffers.RandomAccessFileTransactionBuffer.transferFrom(RandomAccessFileTransactionBuffer.java:156)
com.mobixess.jodb.core.io.JODBIOBase.applyTransaction0(JODBIOBase.java:501)
com.mobixess.jodb.core.io.JODBIOBase.applyTransaction0(JODBIOBase.java:433)
com.mobixess.jodb.core.io.JODBIOBase.applyTransaction(JODBIOBase.java:336)
com.mobixess.jodb.core.JODBSessionContainer.commit(JODBSessionContainer.java:202
com.mobixess.jodb.core.JODBSessionContainer.commit(JODBSessionContainer.java:191)
</pre><br />
So now I got a working TestIndex for JODB, so soon I'll hopefully have some results on the emulator and on the ADP1. The biggest problem I found with using JODB is the lack of documentation, so if you're considering using it you should be aware that it's not that much help to get.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com1tag:blogger.com,1999:blog-4526999273216466271.post-68340507761518586682009-10-08T21:16:00.000+02:002009-10-08T21:16:20.301+02:00JODB (Java Objects Database) for AndroidJODB (Java Objects Database) is an open source object-oriented database that is somewhat similar to db4objects. <br />
<br />
<b>License</b><br />
JODB is completely free for personal and commercial use.<br />
<br />
<div><b>JODB</b><br />
</div><div><b><span style="font-weight: normal;">The developer of JODB sais that JODB is created with performance, size and scalability in mind. It uses soft reference based caches to effectively use the available ram but at the same time reduce the memory footprint as much as possible when memory is pricey, like it is on Android.</span></b><br />
</div><div><div>The developer say that the queries are optimized to the minimal of objects instantiations during the search so that garbage collector will have more time to 'rest' which is especially important for busy server applications (GC as is expensive and this is unlikely to change in near future).<br />
</div><div><b><br />
</b><br />
</div><div><b>Things you should watch out for</b><br />
</div><div>The Android version of JODB does <span style="color: blue;">not have the Client/Server</span> functionality and can thus only be used as an embedded database. This really doesn't matter that much to me, as I was going to use it as an embedded database anyway, but it is something to take not of. The current version of JODB mini <i><b><span style="color: blue;">doesn't</span></b></i> support running of<i> </i><span style="background-color: white;"><i><b><span style="color: blue;">native queries</span></b></i></span>. The developer(s) say this will be corrected in future versions, but that's a long time ago so I'm not really sure that it will happen . And at last the big one you must use <span style="color: blue;">com.mobixess.jodb.core.JodbMini <span style="color: black;">as the entry point instead of <span style="color: blue;">com.mobixess.jodb.core.JODB.</span></span></span><br />
</div><div><span style="color: blue;"></span><br />
</div>So opening a database would look something like this: <span style="color: blue;"> <span style="color: black;">JodbMini.open(databaseName) ;</span></span><br />
<div><br />
<b>Problems related to android</b><br />
</div><div><b><span style="font-weight: normal;">JODB have had Android support for a long time ( since 2007 ), but Android has changed a bit since they released their JODB Mini. RandomAccessFileBufferFactory.createBuffer in JODB, uses File.createTempFile() which creates a new file in the directory that is defined by the java.io.tmpdir system property. Using this method not a recommended practice in Android, as it will fill up data in a folder that might not be cleaned up, making the application fill up a lot of space, that we won't get back until it cleanup. It seems that Android( at least in 1.6 ) have solved this problem by setting the java.io.tmpdir to the SDCARD. But still we don't want to pollute our SDCARD directory with lots of temporary files, and in this case we want the files to be written and read fast so the SDCARD is not a good option. An other thing is that Android as of 1.6 Applications need explicit permission to be allowed to write to the SDCARD through the android.permission.WRITE_EXTERNAL_STORAGE permission.</span></b><br />
</div><div><b><span style="font-weight: normal;">To fix this you can:</span></b><br />
</div><div><ol><li>Give the application write access to the SDCARD.</li>
<li>Set the "java.io.tmpdir" property to somewhere on the phone where the application can write, like in it's own "home" directory.</li>
</ol>The nice thing about setting the "java.io.tmpdir" property property to a directory within the applications own directory is that when you remove the application from the device, all of the related data will also be removed.<br />
<br />
I here set the temp directory to a directory with the application directory so I can clean up the temp files by just deleting the contents of that directory.<br />
<br />
<span style="color: blue;"><span class="Apple-style-span" style="background-color: #cccccc;">File dir = this.getDir("TMP", 0);</span></span><br />
<span style="color: blue;"><span class="Apple-style-span" style="background-color: #cccccc;">String newTempDir = dir.getAbsolutePath();</span></span><br />
<span style="color: blue;"><span class="Apple-style-span" style="background-color: #cccccc;">System.setProperty("java.io.tmpdir", newTempDir);</span></span><br />
<br />
<b>Documentation</b><br />
<a href="http://www.java-objects-database.com/jodb-general-section/help/jodb-help.html">JODB help page</a> and javadoc is the only documentation that I found on JODB. JODB mini can be fetched <a href="http://www.java-objects-database.com/component/option,com_remository/Itemid,33/func,select/id,5/">here</a>.<br />
<br />
</div></div>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com1tag:blogger.com,1999:blog-4526999273216466271.post-63359146794313893022009-10-07T19:25:00.000+02:002009-10-07T19:25:24.186+02:00Signing Android applications<div><strong><span class="Apple-style-span" style="font-size: x-large;">Signing</span></strong><br />
When you're developing Applications for Android you need to sign them. This must be done with a digital certificate that is owned by you, the<br />
application developer.<br />
<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-size: x-large;">Why sign?</span></span><br />
There are several reasons for signing your applications; the most important reason is that Android needs to know who made the application and what applications an application can trust. Therefore the application must be signed with "your" private key.<br />
Another reason as of the 1.6 SDK is to align your resources in your application packages. As mention in the previous post about Zipaling, the packages should be aligned after the application is signed.There are a lot of other aspects of signing in Android than one would think.<br />
<strong>Application upgrading</strong>, Android won't allow application to be upgraded unless signed with same certificate the applications are signed with the same key.<br />
<strong>Application modularity</strong>, Android allows applications that are signed with the same certificate to run in the same processes. This way you can deploy your application as modules.<br />
<strong>Code/data sharing </strong>through permissions - the Android system provides a signature-based permissions enforcement, so that an application can expose functionality to another application that is signed with same certificate. So by signing multiple applications with the same certificate and using signature-base permissions<br />
checks, your application can share code and data in a secure manner.<br />
<strong>Validity</strong><br />
25 years or more is recommended. After the key's validity is expired, users will no longer be able, seamlessly upgrade to new versions of you application. When choosing the validity of your there are several aspects you should consider. As it must exceed all of the applications, including depending applications (modules) added in the future.<br />
<strong>Marked</strong><br />
If you plan to put your applications on the Android Marked your validity period must be after 22. October 2033. This date is enforced by the Android Market Server and is put into place to ensure that users can seamlessly upgrade their applications.<br />
<strong>When to sign</strong><br />
When your application is ready to be released to the "market", you should check that it is signed for "release", as the debug keys that are generated by the SDK won't do.<br />
<strong><span class="Apple-style-span" style="font-size: x-large;">How to sign</span></strong><br />
There are two ways of signing your applications. Manually and from the build tool that you might be using environment in Android this will be Ant or ADT.<br />
<strong>Manual approach:</strong><br />
The manual approach where you use the Keytool and Jarsigner from the command-line. These tools are bundled with the java development kit (JDK). When doing this you first compile your application as an unsigned .apk. After this you must a create keystore/key if you don’t allready has one. You can create the keystore/key by running keytool.<br />
<strong> Creating keystore/key with Keytool:<br />
</strong> The line below will create a keystore/key which you can use to sign your packages. The keystore file is a password protected file that stores keys and certificates that you use in the signing of you application.<br />
<em><br />
</em><br />
<em>keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000</em><br />
<br />
When you run keytool with the following parameters you it will ask you about information that it needs to create your keystore.<br />
<br />
<i>Enter keystore password:</i><br />
<i>Re-enter new password:</i><br />
<i>What is your first and last name?</i><br />
<i>[Unknown]: Jon Doe</i><br />
<i>What is the name of your organizational unit?</i><br />
<i>[Unknown]: R&D</i><br />
<i>What is the name of your organization?</i><br />
<i>[Unknown]: Corparation</i><br />
<i>What is the name of your City or Locality?</i><br />
<i>[Unknown]: Kongsberg</i><br />
<i>What is the name of your State or Province?</i><br />
<i>[Unknown]: Buskerud</i><br />
<i>What is the two-letter country code for this unit?</i><br />
<i>[Unknown]: NO</i><br />
<i>Is CN=Jon Doe, OU=R&D, O=Corparation, L=Kongsberg, ST=Buskerud, C=NO correct?</i><br />
<i>[no]: yes</i><br />
<i>Generating 1á024 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10á000 days for: CN=Jon Doe, OU=R&D, O=Corparation, L=Kongsberg, ST=Buskerud, C=NO</i><br />
<i>Enter key password for alias_name</i><br />
<i>(RETURN if same as keystore password):</i><br />
<i>[Storing my-release-key.keystore]</i><br />
<br />
<em>-genkey:<span class="Apple-style-span" style="font-style: normal;">tells keytool to create a key pair (public and private)</span></em><br />
<em>-v<span class="Apple-style-span" style="font-style: normal;">: Enable verbose output.</span></em><br />
<span class="Apple-style-span" style="font-style: italic;">-keystore<span class="Apple-style-span" style="font-style: normal;">: The location of the keystore file, where the information is going to be stored.</span></span><br />
<span class="Apple-style-span" style="font-style: italic;">-validity<span class="Apple-style-span" style="font-style: normal;">: The validity of the key, given in days.</span></span><br />
<span class="Apple-style-span" style="font-style: italic;">-alias<span class="Apple-style-span" style="font-style: normal;">: The alias of your entry inside the keystore file</span></span><br />
<span class="Apple-style-span" style="font-style: italic;">-keyalg:<span class="Apple-style-span" style="font-style: normal;">specifies the algorithm to be used to generate the key pair.</span></span><br />
<br />
The keystore you just have made, you should put somewhere safe as this will be your identification as an Application developer. If someone gets a hold of your keystore they can sign applications with your identification.<br />
<br />
<strong>Signing application with Jarsigner:</strong><br />
To sign your application with the key you created with the line above, you can the jarsigner tool.<br />
<i>jarsigner -verbose -keystore my-release-key.keystore my_application.apk alias_name</i><br />
<br />
<i>Enter Passphrase for keystore:</i><br />
<i>adding: META-INF/ALIAS_NA.SF</i><br />
<i>adding: META-INF/ALIAS_NA.RSA</i><br />
<i>signing: res/drawable/icon.png</i><br />
<i>signing: res/layout/main.xml</i><br />
<i>signing: res/layout/other.xml</i><br />
<i>signing: AndroidManifest.xml</i><br />
<i>signing: resources.arsc</i><br />
<i>signing: classes.dex</i><br />
<br />
Once your application is signed, don't forget to run zipalign on the APK for additional optimization.<br />
<br />
<strong>Using ADT</strong><br />
The Android SDK tools have options to assist you in signing your applications when debugging, and when you are ready for a release. Both the Android Development Tool (ADT) plug-in for Eclipse and ANT support debug and release mode signing, not going to go in to ANT signing now.<br />
<strong> Debug mode signing<br />
</strong><br />
When you are developing and testing, you typically compile in debug mode. In this mode the build tools automatically use the Keytool from the JDK, creates a keystore and a key with a known key and alias. Since the password is known, the tools don't prompt you for the keystore/key password each time you compile. The self-signed certificate that is used to sign your application in default mode, have an expiration date of 365 days after its creation.So after a year you started signing in debug mode you might encounter:<br />
<i>debug:</i><br />
<i>[echo] Packaging bin/samples-debug.apk, and signing it with a debug key...</i><br />
<i>[exec] Debug Certificate expired on 8/4/08 3:43 PM</i><br />
To remedy this you can delete the debug.keystore in the default storage location for AVD.<br />
<br />
<span class="Apple-style-span" style="font-weight: bold;">ADT release signing</span><br />
Luckily the ADT can do all this for you in the ADT Export Wizard. It can even generate the key for you. And as mentioned in the <a href="http://tordtech.blogspot.com/2009/10/aligning-resources-in-android-packages.html">previous post</a> it will even do the aligning for you.<br />
<div align="center"><a href="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/Ssr_mvc2lcI/AAAAAAAAAD0/SuRKps6avow/s1600-h/ADT+sign.png"><br />
<img border="0" height="111" src="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/Ssr_mvc2lcI/AAAAAAAAAD0/SuRKps6avow/s320/ADT+sign.png" width="232" /><br />
</a><br />
<br />
</div><strong>Creating a new keystore</strong><br />
<div align="center">The first thing you do is find the Export Signed Application Package wizard.<br />
</div><div align="center"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/Ssr_q_LyNEI/AAAAAAAAAD8/vbtJgeC_Pp8/s1600-h/ADT+Sign+2.png"> <img border="0" height="174" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/Ssr_q_LyNEI/AAAAAAAAAD8/vbtJgeC_Pp8/s320/ADT+Sign+2.png" width="320" /><br />
</a><br />
<br />
</div><div align="center">Then it will ask you which project you want to export.<br />
</div><div align="center"><a href="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/SssAH790HHI/AAAAAAAAAEU/g_axnzsOgJ8/s1600-h/ADT+Sign+5.png"> <img border="0" height="271" src="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/SssAH790HHI/AAAAAAAAAEU/g_axnzsOgJ8/s320/ADT+Sign+5.png" width="320" /><br />
</a><br />
<br />
</div>The next step you will be asked to either use an existing keystore, or you can create a new one, we'll create a new one first.<br />
<div align="center"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SssAUNmc99I/AAAAAAAAAEk/o9d8s4d4X54/s1600-h/ADT+Sign+6.png"> <img border="0" height="271" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SssAUNmc99I/AAAAAAAAAEk/o9d8s4d4X54/s320/ADT+Sign+6.png" width="320" /><br />
</a><br />
<br />
</div>At this stage you asked to enter an alias and password for this alias and validity for the signing, as well as the First and last name of the signer.<br />
<div align="center"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SssAizXbAJI/AAAAAAAAAEs/oGwul2Pph1U/s1600-h/ADT+Sign+7png.png"> <img border="0" height="271" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SssAizXbAJI/AAAAAAAAAEs/oGwul2Pph1U/s320/ADT+Sign+7png.png" width="320" /><br />
</a><br />
<br />
</div>Now you just got to tell it where to export the signed package, and you're done.<br />
<strong>Using an already existing keystore</strong><br />
If you already have a keystore that you want to use you select the use existing keystore.<br />
<div align="center"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SssCNS87QHI/AAAAAAAAAE0/FuC3TX-Vyw8/s1600-h/ADT+sign+existing+1.png"> <img border="0" height="269" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SssCNS87QHI/AAAAAAAAAE0/FuC3TX-Vyw8/s320/ADT+sign+existing+1.png" width="320" /></a><br />
</div>To use the existing keystore you must select its location and enter the password you entered when creating it.<br />
<div align="center"><br />
<div style="text-align: auto;"><span style="color: #0000ee;"><span class="Apple-style-span"><span style="color: black;"><br />
</span></span></span></div><a href="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/SssCSJlF6eI/AAAAAAAAAE8/4AwpKLU9t2Y/s1600-h/ADT+sign+existing+2.png"> <img border="0" height="242" src="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/SssCSJlF6eI/AAAAAAAAAE8/4AwpKLU9t2Y/s320/ADT+sign+existing+2.png" width="320" /><br />
</a><br />
<br />
</div><div align="center">Now you can use the key that you that you defined when creating the key.<br />
</div><div align="center"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SssCcDqm-MI/AAAAAAAAAFE/iiDebuZAVDY/s1600-h/ADT+sign+existing+3.png"> <img border="0" height="251" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SssCcDqm-MI/AAAAAAAAAFE/iiDebuZAVDY/s320/ADT+sign+existing+3.png" width="320" /><br />
</a><br />
And now you're done, all signed up and ready to go.<br />
</div><div align="center"><br />
</div>For more info on the keytool application <a href="http://java.sun.com/j2se/1.3/docs/tooldocs/win32/keytool.html">here</a>, signing in Android<a href="http://developer.android.com/guide/publishing/app-signing.html"> </a> <a href="http://developer.android.com/guide/publishing/app-signing.html">documentation (recommended)</a><br />
</div>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com4tag:blogger.com,1999:blog-4526999273216466271.post-38246140943172944132009-10-04T16:31:00.000+02:002009-10-04T16:31:22.400+02:00Aligning resources in Android Packages( using zipalign)<div class="MsoNormal" style="line-height: normal;"><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Zipaling:</span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p> </span><br />
<span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">The zipalign tool was added to the SDK in version 1.6. Zipalign optimizes the way the application is packed, this optimizes the way android interacts with your application and may increase the performance of an applciation.</span><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><br />
</div><div class="MsoNormal" style="line-height: normal;"><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Why Zipaling:</span></b><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">The purpose of zipalign is to ensure that all uncompressed data starts with a particular alignment relative to the start of the application file. Specifically, it causes all uncompressed data within the .apk such as images or raw files to be aligned on 4-byte boundaries. This allows for all portions of the apk file to be accessed directly by memory-mapping them with a function known as mmap(), rather than copying all of the data out of them. The mmap() function establishes a mapping between a process' address space and a file, shared memory or typed memory object, in this case the .apk file. The result of this is that you can get a reduction in the amount of RAM that your applications consume when they run. If the resources are not aligned, Android has to explicitly read them, which is slower and also consume more memory.</span><br />
<br />
<span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">For end users using unaligned application can make the Home application and the unaligned application launch slower than they otherwise should. The worst case, installing several applications with unaligned resource will increase the memory pressure, and cause the system to suffer by having constantly having to start and kill processes. This will have the user end up with a slow device with poor battery life.<o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Zipalign and signing:</span></b><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Zipalign must be run after the application, this is because the signing the application after aligning will disrupt the package alignment. As a result of this all of the "automatic integrated alignment" tools do not align packages until they can sign it. <o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">How do I use it? </span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> <o:p></o:p></span><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">ADT</span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">: <o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">If you are developing with Eclipse and using the ADT plug-in, the zipalign tool is integrated into the "Export Wizard". When you select "Export signed application package", ADT signs and automatically runs zipalign on the exported package. If you choose "Export unsigned application package" it won't be aligned due to reasons mentioned above, so if you want to align it, you must sign and align it manually. If you're wondering where the "Export" functions is, it can be found at the first page of the AndroidManifest.xml editor as well as in the "Android tools" menu selection in the projects context menu.<o:p></o:p></span><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><br />
<br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Ant: </span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">With the Ant build script that targets the newest Android API (1.6, API Level 4) have the ability to align the application packages. Older ant build scripts that target older versions of the Android platform will not be aligned and will need to be aligned manually. Debug packages that are built with Ant with 1.6 as a target are aligned and signed by default. Release packages are aligned automatically if Ant has enough information to sign the packages, this cause the aligning has to happen after signing. So in order to have the application signed, and thereby align them, Ant needs to know the location of the keystore and the name of the key in the build.properties. The name of the properties are key.store and key.alias, if these properties are present the signing tool will ask for the store/key password during the build, and after this the tool will sign and align the apk file.<o:p></o:p></span><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><br />
<br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Manually:</span></b><br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">To manually align a package, you'll find the zipalign tool in the in the "tools" folder in the Android 1.6 SDK. It can be used on any application package irrelevant of target version. As stated previously this should be done after the package is signed. To use the tool you will need to use the following syntax:<o:p></o:p></span><b><i><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;"> </span></i></b><br />
<br />
<b><i><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;">zipalign [-f] [-v] <alignment> infile.apk outfile.apk</alignment></span></i></b><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 10pt;"><o:p></o:p></span><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span><br />
<span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">-f : overwrite existing outfile.zip<br />
-v : verbose output<br />
-c : confirm the alignment of the given file, in other words verify the alignment</span><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 10pt;">.<br />
</span><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;">Alignment must always be 4, as Android uses 32 bit alignment, if it is anything else this will be as if it was not aligned.<b><i> </i></b></span><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 10pt;"><o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><br />
<span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">So:<o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">zipalign -v 4 source.apk destination.apk</span></b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Will align your android package.<o:p></o:p></span><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;"> </span></b><br />
<br />
<b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Verification</span></b><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;">:<o:p></o:p> </span><br />
<span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;">You can verify that your package has been aligned properly on can:</span><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 10pt;"> </span><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;"><o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><b><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">zipalign -c -v 4 application.apk<o:p></o:p></span></b><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;"> </span><br />
<br />
<span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;">It is strongly recommended to align your Android applications as it can improve the performance and memory usage, and as it isn't that hard to do I don't see any good reason not to do it.<o:p></o:p></span><br />
</div><div class="MsoNormal" style="line-height: normal;"><span lang="EN-US" style="font-family: "inherit","serif"; font-size: 12pt;">Happy aligning. <o:p></o:p></span><br />
</div><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">Android documentation on </span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><a href="http://developer.android.com/guide/developing/tools/zipalign.html"><span lang="EN-US">Zipaling</span></a></span><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12pt;">. </span>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com6tag:blogger.com,1999:blog-4526999273216466271.post-21777760226356233482009-10-01T23:25:00.000+02:002009-10-01T23:25:38.044+02:00Upgrading Android Developer phone 1(ADP1) from 1.5 to 1.6Discovering that HTC had posted new firmware images on their site, I felt like trying them out to see what new features it had in store, and if it improved performance in any way. However after just after downloading the images, <a href="http://groups.google.com/group/Android-DevPhone-Updating/browse_thread/thread/54f7a05cc06c7072/7b7972ec6f1cad72">discovered </a>that they were wrong and not signed. And that to get the unsigned images to work one would have to wipe the userdata partition, as some google applications failed to start when opening when "signed" userdata was present. Well a bit later the proper images was posted, I downloaded them happy that I did not have to wipe my userdata.<br />
To update the ADP1 there are two strategies: 1. The recovery image way and the fastboot way, I choose to use the fastboot strategy as I did the Recovery-image strategy when I upgraded to to 1.5. So when the image was all downloaded I booted the device in "fastboot" mode. I assume it is called fastboot mode as it boots right away, if it does not boot right away you probabily did something wrong. For my phone i booted up while holding the camera button down, but it might be something else on other phones on <a href="http://developer.htc.com/adp.html%20">HTC's site</a> it say you have to hold the back button down, as one might imagine that didn't work for me. When the phone is in fast boot mode, it should look something like this.<br />
<div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/SsUYU9l6MRI/AAAAAAAAADk/WGKBLqhYDN8/s1600-h/R0015815.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/SsUYU9l6MRI/AAAAAAAAADk/WGKBLqhYDN8/s320/R0015815.JPG" /></a><br />
</div>Some happy looking skateboarding Android characters and in the middle there should say serial something, press the back button until it says FASTBOOT.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SsUYlTvNEmI/AAAAAAAAADs/Vifs6mTYCD0/s1600-h/R0015817.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SsUYlTvNEmI/AAAAAAAAADs/Vifs6mTYCD0/s320/R0015817.JPG" /></a><br />
</div> If you want to exit the fast boot screen you have to hold the MENU+SEND+END buttons down, where Send is the CALL button on the ADP1 and END is the power button(end call).<br />
Well now you have to get the fastboot application, it can be found at HTC's site <a href="http://developer.htc.com/adp.html%20">here</a>.<br />
The fastboot application should be downloaded to the <sdk>\tools directory, as it is dependent on AdbWinApi.dll and will not start without it. If you want to run the fastboot application from another directory you will need to add the <sdk>\tools directory to your PATH enviroment variable. <br />
</sdk></sdk><br />
now you have to type something like this:<b> </b><br />
<b>fastboot.exe update signed-dream_devphone_userdebug-img-14721.zip</b><br />
<i>archive does not contain 'boot.sig'<br />
archive does not contain 'recovery.sig'<br />
archive does not contain 'system.sig'<br />
'waiting device'<br />
</i><br />
If you do not get past the waiting for device part there is something wrong with the connection between the phone and the fastboot application. This may be that it is not connected, the driver migth not be installed or not installed properly, and the phone might not be in fastboot mode.<br />
When successfull there should be some output in the commandline looking something like this:<br />
<i>--------------------------------------------<br />
Bootloader Version...: 0.95.3000<br />
Baseband Version.....: 2.22.19.26I<br />
Serial Number........: HT91RLZ00368<br />
--------------------------------------------<br />
checking product... OKAY<br />
checking serialno... OKAY<br />
checking version-bootloader... OKAY<br />
checking version-baseband... OKAY<br />
checking version-cpld... OKAY<br />
sending 'boot' (1838 KB)... OKAY<br />
writing 'boot'... OKAY<br />
sending 'recovery' (2088 KB)... OKAY<br />
writing 'recovery'... OKAY<br />
sending 'system' (58570 KB)... OKAY<br />
writing 'system'... OKAY<br />
rebooting...</i><br />
When rebooting it might take a bit longer than usual. And then you're done, if you look at the Android market it should look something like this. <br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SsUWjsH4stI/AAAAAAAAADc/HTh7A-jmLVs/s1600-h/device.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SsUWjsH4stI/AAAAAAAAADc/HTh7A-jmLVs/s320/device.png" /></a><br />
</div>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com1tag:blogger.com,1999:blog-4526999273216466271.post-64409913633223888512009-09-30T18:05:00.004+02:002009-09-30T18:08:36.643+02:00TestIndex on Android developer phone1(ADP1) with Berkeley DBAfter a long day of testing I got some results on the ADP1. BerkeleyDB does seem to like heap space more than the other database managament systems(DBMS), but it seems to be able to run ok. I think I'll need to think about ways to shrink the memory usage of the different tests. <br />
<br />
<div style="text-align: center;">Well here are the results:<br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SsOA4AGazDI/AAAAAAAAADU/ebKHAjR8QwY/s1600-h/graph-adp1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SsOA4AGazDI/AAAAAAAAADU/ebKHAjR8QwY/s320/graph-adp1.png" /></a><br />
</div><br />
<center><br />
<table border="1" cellpadding="0" cellspacing="0" height="126" style="border-collapse: collapse; width: 398px;"><col span="4" style="width: 60pt;" width="80"></col> <col style="width: 76pt;" width="101"></col> <tbody>
<tr height="35" style="height: 26.25pt;"> <td height="35" style="height: 26.25pt; text-align: center; width: 60pt;" width="80"><br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">Perst-ADP1<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">SQLite-ADP1<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">DB4O-ADP1<br />
</td> <td class="xl65" style="text-align: center; width: 76pt;" width="101">BerkeleyDB-<br />
ADP1<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">insert<br />
</td> <td class="xl66" style="text-align: center;">21150<br />
</td> <td class="xl66" style="text-align: center;">600824<br />
</td> <td class="xl66" style="text-align: center;">88059<br />
</td> <td class="xl66" style="text-align: center;">113668<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">search<br />
</td> <td class="xl66" style="text-align: center;">16176<br />
</td> <td class="xl66" style="text-align: center;">107514<br />
</td> <td class="xl66" style="text-align: center;">470561<br />
</td> <td class="xl66" style="text-align: center;">74417<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">iterate<br />
</td> <td class="xl66" style="text-align: center;">11747<br />
</td> <td class="xl66" style="text-align: center;">6777<br />
</td> <td class="xl66" style="text-align: center;">90657<br />
</td> <td class="xl66" style="text-align: center;">62190<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">delete<br />
</td> <td class="xl66" style="text-align: center;">37704<br />
</td> <td class="xl66" style="text-align: center;">562522<br />
</td> <td class="xl66" style="text-align: center;">155778<br />
</td> <td class="xl66" style="text-align: center;">215499<br />
</td> </tr>
</tbody></table></center>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com1tag:blogger.com,1999:blog-4526999273216466271.post-34500021257452991382009-09-30T09:49:00.002+02:002009-09-30T10:36:54.061+02:00TestIndex on Android emulator now also with BerkeleyDBIt's taken a bit longer time than I had expected to get some TestIndex results for BerkeleyDB on Android. A while back I had a running version up and running, but managed somehow to messup the serialization part, so I had to create a new version from scratch that does not use serialization. Instead I used BerkeleyDB's custom TuppleBinding which gives somewhat better performance than serilization. I hope to soon be able to post results using serilization as well, to compare the difference in performance. I will also do some research into the other database management systems that I have tested to see if they have similar optimalizations that can be used.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SsMNCJ4IVPI/AAAAAAAAADM/lYc8k2hOX3c/s1600-h/graph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/SsMNCJ4IVPI/AAAAAAAAADM/lYc8k2hOX3c/s320/graph.png" /></a><br />
</div><div style="text-align: center;">Results from the test in milliseconds.<br />
</div><center><br />
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 400px;"><col span="5" style="width: 60pt;" width="80"></col> <tbody>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center; width: 60pt;" width="80"><br />
</td> <td class="xl63" style="text-align: center; width: 60pt;" width="80">Perst-Emu<br />
</td> <td class="xl63" style="text-align: center; width: 60pt;" width="80">SQLite-Emu<br />
</td> <td class="xl63" style="text-align: center; width: 60pt;" width="80">DB4O-Emu<br />
</td> <td class="xl63" style="text-align: center; width: 60pt;" width="80">BerkeleyDB-Emu<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">insert<br />
</td> <td class="xl64" style="text-align: center;">15158<br />
</td> <td class="xl64" style="text-align: center;">72426<br />
</td> <td class="xl64" style="text-align: center;">46648<br />
</td> <td class="xl64" style="text-align: center;">55698<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">search<br />
</td> <td class="xl64" style="text-align: center;">12480<br />
</td> <td class="xl64" style="text-align: center;">100528<br />
</td> <td class="xl64" style="text-align: center;">290541<br />
</td> <td class="xl64" style="text-align: center;">37612<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">iterate<br />
</td> <td class="xl64" style="text-align: center;">8365<br />
</td> <td class="xl64" style="text-align: center;">5157<br />
</td> <td class="xl64" style="text-align: center;">51335<br />
</td> <td class="xl64" style="text-align: center;">29484<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">delete<br />
</td> <td class="xl64" style="text-align: center;">25100<br />
</td> <td class="xl64" style="text-align: center;">65498<br />
</td> <td class="xl64" style="text-align: center;">93396<br />
</td> <td class="xl64" style="text-align: center;">100455<br />
</td> </tr>
</tbody></table><br />
<br />
<br />
<br />
<br />
</center>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com0tag:blogger.com,1999:blog-4526999273216466271.post-17025830912613732142009-09-27T23:26:00.000+02:002009-09-27T23:26:45.244+02:00BerkeleyDB for Java on AndroidAfter having tried a couple of databases on Android I thought it would be nice to add another one to the bunch. So after a little searching I found BerkeleyDB for Java, downloaded it and tried to run it on the Android emulator. To get it to work with Android there are some instruction in a HowToAndroid.hmtl file that's bundled with the documentation. It describes the required modifications that are needed to do to the source in order to get it to work. There are a couple of folders that need to be deleted and some extra java files that need to be created, but all-in-all it's quite manageable. After doing the required modification to the source of BerkeleyDB I tried to run a sample small sample that I had for BerkeleyDB and ended up with this exception: "com.sleepycat.je.log.LogException: (JE 3.3.87) java.io.FileNotFoundException: /data/je/je.lck". I concluded that this had to do with BerkeleyDB's need for a folder to store it's enviroment(database files, logs). BerkeleyDB requires you to create this folder, or else you will need end up with the lovely exception above. In the how to there is some instructions on how to create the environment( folders ) for BerkeleyDB, "adb shell mkdir /data/je" and removal of the folder by "adb shell rm /data/je/*". This is a bit quirky, and leaves you with the responsibility of cleaning after you application, as the folder is directly placed in the data folder and not in the "home" folder of your application. So I'd recommend using the Activity.getDir("folderName", 0) or something similar to create the directory for BerkeleyDB, so that it will be cleaned up when the application is removed. So sum it all up I got it up and running and in a couple of days I'll post some results from the benchmark.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com0tag:blogger.com,1999:blog-4526999273216466271.post-23303975874847380222009-09-27T14:28:00.002+02:002009-09-27T14:29:28.964+02:00Memory limit in AndroidIt has come to my attention that Android applications have a heap limit of 16MB. Normally this won't pose a problems to ordenary applications, but I have found that it isn't as hard as one would think to reach this limit, especially when you are doing resource intensive things like testing. When the heap size reaches above 16MB you will get an java.lang.OutOfMemoryError exeption. <br />
It is posible to increase this limit, but it seem to require direct intervension into the the Android source. By defining a compile flag, CUSTOM_RUNTIME_HEAP_MAX one can set the parameter that defines the max heap size of dalvik. This flag will then be used by the AndroidRuntime::start method in the frameworks/base/core/jni/AndroidRuntime.cpp to define the -Xmx parmater that sets the max heap size of dalvik.<br />
<br />
ifdef CUSTOM_RUNTIME_HEAP_MAX<br />
#define __make_max_heap_opt(val) #val<br />
#define _make_max_heap_opt(val) "-Xmx" __make_max_heap_opt(val)<br />
opt.optionString = _make_max_heap_opt(CUSTOM_RUNTIME_HEAP_MAX);<br />
#undef __make_max_heap_opt<br />
#undef _make_max_heap_opt<br />
#else<br />
/* limit memory use to 16MB */<br />
opt.optionString = "-Xmx16m";<br />
#endif<br />
<br />
So if you define CUSTOM_RUNTIME_HEAP_MAX with a value like "20m" you will have increased the maximum heap size to 20MB.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com21tag:blogger.com,1999:blog-4526999273216466271.post-84981184801511510732009-09-26T14:32:00.001+02:002009-09-26T14:37:02.904+02:00Stopping Android from sleepingYesterday I published the source for the extended Android TestIndex application. The primary difference from that my extension and the original is the introduction of wakelocks. The reason for that is that when tests started to use longer and longer time, I felt a need to be able to do the tests without having to hover over the phone and push "menu" to give it input, and thus stopping it from going into sleep mode. Another thing that was starting to happen was that if the test took really long time and I just left the phone running it would restart the application, and thus removing any results that it may or may not have produced. So I started to digg into a way to keep the CPU from going into sleepmode while the tests was running. After a short while I found the PowerManager sections in the Android documentation, which talks about wakelocks. The wakelocks are aquired from the PowerManager, and controls the different sleep stages that the phone goes into. I choose to use the partial wakelock wich just keeps CPU from sleeping, but allows the screen and keyboard to go into various sleep stages. Below I've pasted the table from the Android documentation that tells what the different wakelocks do.<br />
<table align="center" border="1"><tr><th>Flag Value</th><th>CPU</th><th>Screen</th> <th>Keyboard</th></tr> <tr><th><a href="http://developer.android.com/reference/android/os/PowerManager.html#PARTIAL_WAKE_LOCK">PARTIAL_WAKE_LOCK</a></th><td>On*<br />
</td><td>Off</td><td>Off</td></tr><tr><th><a href="http://developer.android.com/reference/android/os/PowerManager.html#SCREEN_DIM_WAKE_LOCK">SCREEN_DIM_WAKE_LOCK</a><br />
</th><td>On</td><td>Dim</td><td>Off</td></tr><tr><th><a href="http://developer.android.com/reference/android/os/PowerManager.html#SCREEN_BRIGHT_WAKE_LOCK">SCREEN_BRIGHT_WAKE_LOCK</a><br />
</th><td>On</td><td>Bright</td><td>Off</td></tr><tr><th><a href="http://developer.android.com/reference/android/os/PowerManager.html#FULL_WAKE_LOCK">FULL_WAKE_LOCK</a></th><td>On</td><td>Bright</td><td>Bright</td></tr></table><pre class="Code prettyprint"> </pre>So to solve the problem you just:<br />
<pre class="Code prettyprint">PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakelock");
wl.acquire();
// test code
wl.release();</pre><pre class="Code prettyprint"> </pre>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com1tag:blogger.com,1999:blog-4526999273216466271.post-4597018530384684912009-09-25T22:17:00.000+02:002009-09-25T22:17:04.030+02:00TestIndex with DB4O(part two) on Android developer phone(ADP1)<div class="separator" style="clear: both; text-align: center;">I finished my ADP1 testing early this morning and here are the results.<br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/Sr0jdOc0ukI/AAAAAAAAADE/U6wQ4g3yx9M/s1600-h/Graph+ADP1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/Sr0jdOc0ukI/AAAAAAAAADE/U6wQ4g3yx9M/s320/Graph+ADP1.png" /></a><br />
</div>Here are the results:<br />
<center><br />
<table border="1" cellpadding="0" cellspacing="0" height="106" style="border-collapse: collapse; width: 395px;"><col span="4" style="width: 60pt;" width="80"></col> <tbody>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center; width: 60pt;" width="80"><br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80"><b>Perst-ADP1</b><br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80"><b>SQLite-ADP1</b><br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80"><b>DB4O-ADP1</b><br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">insert<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">20583<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">444980<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">83922<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">search<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">15982<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">103047<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">471148<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">iterate<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">11187<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">6578<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">88179<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">delete<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">28798<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">432789<br />
</td> <td class="xl65" style="text-align: center; width: 60pt;" width="80">156262<br />
</td> </tr>
</tbody></table><br />
<br />
</center><br />
Here we also see that DB4O uses a long time on the search as it did on the Emulator, still don't have a good eplanation for this, I can only speculatate that it has something to do with the way it stores its records. But we allso see that SQLite uses a lot of time on the insert and delete part, which I think has to do with free memory, as my ADP1 still has quite a few application installed.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com0tag:blogger.com,1999:blog-4526999273216466271.post-46711796861910810182009-09-25T22:00:00.000+02:002009-09-25T22:00:41.289+02:00Android TestIndex extended with DB4O sourceAfter a request I've uploaded the source for the Android TestIndex with DB4O <a href="http://www.ninjapus.net/Android/Benchmark.zip">here</a>, so that anyone that wants can have a look at it and perhaps come with sugestions for improvements.The original application can be found at McObjects site <a href="http://www.mcobject.com/index.cfm?fuseaction=do_download&file=testindex%2Dandroid%2Ezip&filename=TestIndex%20for%20Android">here</a> To run the application you will need a copy of Perst, which can be found at McObjects site <a href="http://www.mcobject.com/index.cfm?fuseaction=do_download&file=perst%2D415%2Ezip&filename=Perst%20and%20Perst%20Lite%20for%20Java">here</a>. You will also need a copy of DB4O as well which can be found <a href="http://www.db4o.com/community/qdownload.aspx?file=java.zip">here</a> and the Android development kit which can be downloaded <a href="http://developer.android.com/sdk/download.html?v=android-sdk-windows-1.5_r3.zip">here</a>. .For those who doesn't want to go through the hazzle of setting up the eclipse project, and downloading all of the different components needed to compiling the test I've created an APK that can be found <a href="http://www.ninjapus.net/Android/Benchmark.apk">here</a>.Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com0tag:blogger.com,1999:blog-4526999273216466271.post-71065687232834324532009-09-24T15:15:00.001+02:002009-09-24T15:17:51.611+02:00TestIndex with DB4O(part one) on Android EmulatorWhen I did my last benchmark on the Android I got a question if I had tried out DB4O on Android, something I had not. So I had to try it out, to see how it was to use on the Android platform and compare it to SQLite and Perst. Using object oriented databases makes it alot easyer to develop applications as you can think "objects" all though out the development process, where you don't have to think about converting the results back into obejcts again. Using DB4O on android worked completely painless, and after some searching I found a compatible version of the TestIndex application for DB4O that I could integrate in the android. Below are the results for the emulator, I hope that i can test it on the ADP1 later today. How did I test ? I ran the test index application several times until I got some stable / reliable results.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/SrtuvIa3b2I/AAAAAAAAAC8/OaTdUGYyNh0/s1600-h/Graph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/SrtuvIa3b2I/AAAAAAAAAC8/OaTdUGYyNh0/s320/Graph.png" /></a><br />
</div><div class="separator" style="clear: both; text-align: center;">Here is a graph of the results on the emulator. <br />
</div><br />
<center><br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 320px;"><col span="4" style="width: 60pt;" width="80"></col> <tbody>
<tr height="36" style="height: 27pt;"> <td class="xl67" height="36" style="height: 27pt; width: 60pt;" width="80"><br />
</td> <td class="xl68" style="text-align: center; width: 60pt;" width="80">Perst-Emulator<br />
</td> <td class="xl68" style="border-left: medium none; text-align: center; width: 60pt;" width="80">SQLite-Emulator<br />
</td> <td class="xl69" style="text-align: center; width: 60pt;" width="80">DB4O-Emulator<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td class="xl70" height="20" style="height: 15pt; text-align: center;">insert<br />
</td> <td class="xl66" style="border-left: medium none; text-align: center; width: 60pt;" width="80">11465<br />
</td> <td class="xl66" style="border-left: medium none; text-align: center; width: 60pt;" width="80">67420<br />
</td> <td class="xl71" style="border-left: medium none; text-align: center; width: 60pt;" width="80">36980<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td class="xl72" height="20" style="border-top: medium none; height: 15pt; text-align: center;">search<br />
</td> <td class="xl65" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">9601<br />
</td> <td class="xl65" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">90328<br />
</td> <td class="xl73" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">226624<br />
</td> </tr>
<tr height="20" style="height: 15pt;"> <td class="xl72" height="20" style="border-top: medium none; height: 15pt; text-align: center;">iterate<br />
</td> <td class="xl65" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">6578<br />
</td> <td class="xl65" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">4504<br />
</td> <td class="xl73" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">39405<br />
</td> </tr>
<tr height="21" style="height: 15.75pt;"> <td class="xl74" height="21" style="border-top: medium none; height: 15.75pt; text-align: center;">delete<br />
</td> <td class="xl75" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">18408<br />
</td> <td class="xl75" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">59998<br />
</td> <td class="xl76" style="border-left: medium none; border-top: medium none; text-align: center; width: 60pt;" width="80">71463<br />
</td> </tr>
</tbody></table><br />
</center><br />
<div class="separator" style="clear: both; text-align: center;">If we look at the results we see that the only thing that is really standing out is the search on the DB4O, I have no good explanation for this.<br />
</div>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com2tag:blogger.com,1999:blog-4526999273216466271.post-16405213886955638702009-09-15T23:28:00.019+02:002009-09-15T23:42:44.294+02:00Android Perst Benchmark on ADP1(1.5) and emulatorI downloaded the new version of the Perst TestIndex bechmark application from McObject today, and it worked like a charm. When you start the test you can choose to do a benchmark of Perst or SQLite. The Perst part of the benchmark finnishes pretty quickly on the ADP1, but the SQLlite part takes 15 min to finish with(35MB memory free). I allso ran it on the Emulator to see how the results would differ. <br />
The<a href="http://www.blogger.com/goog_1253039277493"> test</a><a href="http://www.mcobject.com/index.cfm?fuseaction=do_download&file=testindex%2Dandroid%2Ezip&filename=TestIndex%20for%20Android"> application </a> can be downloaded from McObject's site, and McObject have published a <a href="http://www.mcobject.com/index.cfm?fuseaction=do_download&file=testindex%2Dandroid%2Ezip&filename=TestIndex%20for%20Android">report </a>containing their results and conclusion of running the Applicaiton on a G1 handset and on the emulator.<br />
Bellow are my results from my execution of the test application on the Emulator and the ADP1: <br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_qyEFi19I/AAAAAAAAAA4/e7JUyQl1gQs/s1600-h/benchmark+Perst+emulator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_qyEFi19I/AAAAAAAAAA4/e7JUyQl1gQs/s200/benchmark+Perst+emulator.png" /></a></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div style="text-align: center;">The results of the Perst test on the emulator</div><div style="text-align: center;"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_qjWqN5EI/AAAAAAAAAAw/bdeIVd0CX8s/s1600-h/benchmark+SQLite+emulator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_qjWqN5EI/AAAAAAAAAAw/bdeIVd0CX8s/s200/benchmark+SQLite+emulator.png" /></a> </div><div style="text-align: center;">The results of the SQLlite test on the emulator</div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_y2GiYhVI/AAAAAAAAABQ/g2Wi_UQToMk/s1600-h/benchmark+graph+emulator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_y2GiYhVI/AAAAAAAAABQ/g2Wi_UQToMk/s320/benchmark+graph+emulator.png" /></a> </div><div class="separator" style="clear: both; text-align: center;">Graph of results on emulator</div><br />
<center><br />
<br />
<table border="0" cellpadding="0" cellspacing="0" height="120" style="border-collapse: collapse; width: 336px;"><tbody>
<tr align="center" height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center; width: 74pt;" width="98"></td> <td style="width: 76pt;" width="101">Perst Emulator</td> <td style="width: 60pt;" width="80">SQLite Emulator</td> </tr>
<tr align="center" height="20" style="height: 15pt;"> <td height="20" style="height: 15pt;">insert</td> <td>12455</td> <td>94676</td> </tr>
<tr align="center" height="20" style="height: 15pt;"> <td height="20" style="height: 15pt;">search</td> <td>9836</td> <td>98260</td> </tr>
<tr align="center" height="20" style="height: 15pt;"> <td height="20" style="height: 15pt;">iterate</td> <td>7240</td> <td>4625</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">delete</td> <td style="text-align: center;">30707</td> <td style="text-align: center;">77907</td> </tr>
</tbody></table></center><br />
<div class="separator" style="clear: both; text-align: center;"></div><div style="text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_vJHF31CI/AAAAAAAAABA/n1T62n_u7yI/s1600-h/benchmark+Perst+ADP1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_vJHF31CI/AAAAAAAAABA/n1T62n_u7yI/s200/benchmark+Perst+ADP1.png" /></a></div><div style="text-align: center;">The results of the Perst test on the ADP1 handset with around 7MB space free</div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_v4k73VpI/AAAAAAAAABI/WqgLFTOrJuw/s1600-h/benchmark+SQLite+ADP1+%281%29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/Sq_v4k73VpI/AAAAAAAAABI/WqgLFTOrJuw/s200/benchmark+SQLite+ADP1+%281%29.png" /></a></div><div style="text-align: left;">The results of the SQLite test on the ADP1 phone with around 7MB space free, I just let it run and looked like it wasn't able to finnish even after more than one hour. So I tried again after some cleanup of various unused applications now with arond 14-20MB free space, still wouldn't finish after 15 minutes, so I shut it down again. Probably a good idea to have an application like "close everything" so the benchmark doen't run the background. So I tried another time now with 35MB free space. Now it finished after about 15 minutes or so, so you'll need some free space on the phone to be able to run the SQLite benchmark within a resonable amout of time.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SrAE-ckMFxI/AAAAAAAAABg/W1gaCoAfKGs/s1600-h/benchmark+Perst+ADP1+%282%29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SrAE-ckMFxI/AAAAAAAAABg/W1gaCoAfKGs/s200/benchmark+Perst+ADP1+%282%29.png" /></a></div><div style="text-align: center;">The results of the Perst test on the ADP1 handset with around 35MB space free </div><div style="text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/SrAFnxr9YwI/AAAAAAAAABo/JM5HJ8yAxmQ/s1600-h/benchmark+SQLite+ADP1+%282%29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Vlp8SaP8-Oo/SrAFnxr9YwI/AAAAAAAAABo/JM5HJ8yAxmQ/s200/benchmark+SQLite+ADP1+%282%29.png" /></a></div><div style="text-align: center;">The results of the SQLite test on the ADP1 handset with around 35MB space free</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SrADwIDViUI/AAAAAAAAABY/XimAqZZ_UYc/s1600-h/benchmark+graph+ADP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Vlp8SaP8-Oo/SrADwIDViUI/AAAAAAAAABY/XimAqZZ_UYc/s200/benchmark+graph+ADP.png" /></a> </div><div class="separator" style="clear: both; text-align: center;">Graph of results on ADP with 35MB free space.</div><div class="separator" style="clear: both; text-align: center;"></div><br />
<center><br />
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 342px;"><col span="2" style="width: 98pt;" width="131"></col> <col style="width: 60pt;" width="80"></col> <tbody>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center; width: 98pt;" width="131"></td> <td style="text-align: center; width: 98pt;" width="131">Perst ADP1</td> <td style="text-align: center; width: 60pt;" width="80">SQLite ADP1</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">insert</td> <td style="text-align: center;">22399</td> <td style="text-align: center;">471281</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">search</td> <td style="text-align: center;">17528</td> <td style="text-align: center;">103076</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">iterate</td> <td style="text-align: center;">11394</td> <td style="text-align: center;">6620</td> </tr>
<tr height="20" style="height: 15pt;"> <td height="20" style="height: 15pt; text-align: center;">delete</td> <td style="text-align: center;">56299</td> <td style="text-align: center;">445178</td> </tr>
</tbody></table></center><br />
<div class="separator" style="clear: both; text-align: center;"></div></div>Tord.Fhttp://www.blogger.com/profile/01726504754742972495noreply@blogger.com0