An Explanation of My Recent "Self Destruct" Application

An Explanation of My Recent “Self Destruct” Application

Self Destruct” is simply an application I made for fun, as a proof of concept. This application demonstrates a way to create an application that is able to “destroy” itself, preventing it from running until it is uninstalled, and then reinstalled later. I’d like to personally thank HandlerExploit for giving me a hint about how to do this (he mentioned that he found the trick in the provisioning code). HandlerExploit uses a similar technique in his application, “iBrick Proof of Concept”. As soon as the user opens the application, it removes it’s main class from the Dalvik package manager, preventing itself from being able to run again. The only way to run the application again after opening it is to uninstall the application, and reinstall it. This application serves no real purpose other than to demonstrate an interesting trick, and it is not malicious in any way. Please note that after running the application, it’s icon will remain in the launcher, although you won’t be able to open it. Uninstalling the application will remove the icon. I’d release the entire source code for this application, but really, the only part that actually matters is the part that removes the class from Dalvik and prevents the application from running again. Interestingly, this application requires absolutely no permissions, at all in order to do this. In case you are interested in how I did this, here is the source code for the main class in the project:

package com.dylantaylor.selfdestruct;
import android.app.Activity;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.os.Bundle;

public class Main extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        PackageManager pm = getPackageManager(); ComponentName name = new ComponentName(this, Main.class);
        pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
    }
}

Yes, I realize that this application serves no real purpose, but it’s just something interesting that I made for fun. If you don’t want it, don’t download it. Otherwise, have fun! 🙂

P.S. Do whatever you want with that source code, it’s virtually worthless to me anyways.

Sound Added to "Simple Dice"!

Sound Added to “Simple Dice”!

I added sound to “Simple Dice” when you roll the dice. The sound played is a modified, low quality version of Mike Koenig’s “Shake and Roll Dice Sound”. The file takes up less than 10 additional kilobytes, and the sound is only played if the “Media volume” is not muted, to avoid disturbing others.  I also plan on adding the sound to “Dice Betting” when it is released. The sound truly makes the application more realistic feeling and more interesting. Expect to see the changes on GitHub and the Android market shortly!

UPDATE: The sounds are now in the git repository, and the new version is up on the market!

Introducing “Simple Dice”

Introducing “Simple Dice”

This isn’t quite the dice game that I’m currently working on, but I liked the animation I made so much in the other game (“Dice Betting”) that I just had to release an Android application with just the dice images and the animation. Simply tap anywhere on the screen in order to roll the dice. Dice rolls are random. Simple Dice will definitely be released under version 3 of the GNU General Public license, and the source will be available online as soon as I get a chance to upload it. I will update this post with the link to the source code once it’s online. Until then, check it out in the Android market! It’s 100% free! Also, the entire application takes up only a measly 24KB! 😉

UPDATE: The source code is now available on GitHub! Check it out! 🙂

Working on a New Simple Dice Game

Working on a New Simple Dice Game

I’ve been working on creating a basic dice game for Android with animation, rules, betting, and more! The game is currently a work in progress, but I’m really excited to release it! The animation works wonderfully, and the interface, although very unfinished is already starting to look polished, especially in the game’s menus. For now, the game is simply called “Dice Betting”, and yes, I realize how lame and generic that sounds, but I might end up changing the name of the game before it is released. Similar to “Find the Mouse”, I’ll probably end up open sourcing this game (under the GNU General Public License, of course), although it isn’t even remotely close to being released yet. The game will have a built-in statistics tracking system, and the rolling of the dice will be completely animated. Right now, the animation I have done looks really cool, and I’m incredibly anxious to publicly release this. Check back soon! 🙂

Find The Mouse Improvements Complete!

Find The Mouse Improvements Complete!

I finished making the changes to “Find The Mouse”, and the new code is up on github. I’m already in the process of signing and uploading the new version to the Android market. You should be able to download it very soon! The new version automatically advances to the next level after you successfully find the mouse, it keeps track of your winning streak and current score, and the user interface feels much nicer. Enjoy! 🙂

UPDATE: The new version is now up on the market! Check it out!

Pssst… Planned Improvements for "Find The Mouse"

Pssst… Planned Improvements for “Find The Mouse”

I realize that “Find The Mouse” isn’t that much fun yet. I’m working on implementing a feature to keep track of scoring. For each round successfully completed, you will get one point plus one point for every click left. The game will also keep track of how many games were won in a row. Keep in mind that this game was never originally designed to be very fun, it was meant to be an example to teach (very) basic Android programming. These upcoming features are simply the result me giving into peer pressure and trying to make the game more enjoyable. Keep in mind that this is an open source project and anyone is welcome to contribute code if they would like to see it in the game. The feature is done as far as coding, I just have to work on the new layout.

Introducing “Find The Mouse”, a Basic Open Source Android Game!

Introducing “Find The Mouse”, a Basic Open Source Android Game!
So, a friend of mine asked me to show them how to make a basic Android game, which resulted in me coding up something simple for him. “Find The Mouse” is the result of this coding. This entire game was started and finished in around 20 minutes today, and the counter was added in later. All of the artwork in the game is public domain artwork found on sites like clker.com. The card background was heavily modified in order to reduce file size and make it look nicer on mobile screens. The object of the game is to find the mouse hidden behind one of five cards. You have three chances to find the mouse before you lose. The game is, as I stated earlier, incredibly simple, yet somewhat useful to someone who is learning to code for the Android operating system. The entire source code as well as all resources are available on GitHub, and I will probably end up putting this on the Android market soon, so that all of you without the Android SDK or the time to compile source code can play with this. This game will definitely be 100% free, and I have no intention of ever charging for it. The version on the market will likely have an AdMob advertisement in it, however, the version on github will not if you have the time to compile it and run it yourself. I am releasing this project under version 3 of the GNU General Public License, and all original artwork created by me in relation to this project is released to the public domain. You may copy, edit, modify and redistibute this project as long as you follow the terms of version 3 of the GPL. Enjoy! The project’s source code can be found on this GitHub repository. 😉

P.S. Hitting the Search button or the Menu button resets the game.

Introducing Currency Converter!

Introducing Currency Converter!
So a couple of days ago I hinted that I was working on a top-secret project. Well, that project is top-secret no more, as Currency Converter is now available for free in the Android market! Currency Converter is a basic application that I originally created in order to practice making Android applications, and to play around with user interface design, in an effort to create a professional-looking Android application. I am pleased to announce that this application ended up being much greater than I originally thought possible. Currency Converter is a extremely data-light application that uses less than 1.5 kilobytes of data every time it refreshes the currency exchange rates. That’s rather impressive, considering the fact that Currency Converter supports 94 different international currencies. The exchange rates are automatically loaded from the Internet in the form of a comma separated value file that contains the latest Google Finance currency rates by using the Google Spreadsheet API, and querying a specially formatted Google Spreadsheet document that I created specifically for this application. In order to minimize data usage, the spreadsheet only contains the current exchange rate of one US dollar to every other supported currency. Because the spreadsheet uses the Google Finance formula function, the spreadsheet is automatically updated with the latest rates. Regularly the Google Finance function is used to retrieve the latest stock quotes, but by inserting “CURRENCY:” into the function, we can use it to convert currency. For example, to convert one US dollar to Euros, we would use: ‘=GOOGLEFINANCE(“CURRENCY:USDEUR”)‘ as our function, where ‘USD’ is the ‘from’ currency’s symbol, and ‘EUR’ is the ‘to’ currency’s symbol. However, adding the full Google Spreadsheet API to the application would add bloat, and that wouldn’t be very good. After all, we only need to retrieve the data, we don’t need to do any server side manipulation or anything. Therefore, I used the next best thing. Google has a feature on their server that allows you to run a basic query on the feed of a publicly published and accessible spreadsheet document.  Because I love sharing useful things that I make, the spreadsheet document used by my currency converter is completely publicly accessible, and I have no plans on restricting access in the future. By using the query “SELECT A,B“, we can retrieve all the data in columns A and B of the spreadsheet. Click here to see an HTML representation of the data that query returns. So, we now have a very basic, stripped down version of the spreadsheet that can be accessed without being logged in, but it has a lot of extra data that we don’t need, and it would be annoying to parse out. Maybe it’s possible to optimize the server output even more? Of course it is! Google offers the ability to retrieve any spreadsheet document as a comma separated value file that’s extremely minimalistic and optimized with almost no excess data. In this case, we can simple set the PHP GET parameter called “tqx” to “out:csv“. This results in a much smaller and easier to parse file being returned by the server. Currency Converter is now available on the Android market for free. Check it out, and if you don’t like it, you can always uninstall it. Let me know what you think. To easily get to the download page in the Android market, simply scan the following QR code with a barcode scanning application:

My Latest Top-Secret Project

My Latest Top-Secret Project

I’ve been playing around a lot with different styles of Android user interface design lately, in order to practice developing for the platform. In my new top-secret project (coming soon!), I spent a lot of time really tweaking and customizing the user interface in order to make it look and feel great. Some new techniques I’ve been experimenting with include: custom background images (with XML layouts), custom spinner layouts, font style and color, alpha-transparency, and a couple of other neat tricks. In addition to that, I also worked on really optimizing the graphics used in the application to reduce file size. How does this all fit together? You’ll soon find out, when I release one of my best looking applications (visually) yet. In addition to just graphical user interface design, I have also been playing around a lot with offloading processing by utilizing server side scripting (sometimes referred to as “Cloud Computing“), and API calls, in this case, to a dynamically updating data feed. In my upcoming application, I learned a lot about sending queries to a server, and parsing the output that is returned in an optimized and efficient way in order to improve reliability over a wireless network. For instance:

  • In my new project, all the data I need is queried and then parsed on the server side into a comma separated value file that is less than 1.5KB of data!
  • Once the data is retrieved, it is parsed on the client side into arrays using string tokenizers and buffered readers so that it can be accessed quickly without a lot of extra processing.
  • No third party libraries that are not included in Android itself are used or needed in order to retrieve and parse any of the data. All of the parsing and retrieving is hand coded from scratch.
  • When a network connection is not available, my application takes advantage of a cached copy of data stored on the phone itself (remember how I said the entire set of data is less than 1.5kb?)

Haven’t guessed what I’m working on yet? That’s ok… stay tuned for more updates and some screenshots as I continue to work on this project. Keep in mind that I will also be working on improving my old applications, such as EliteBomb, at the same time, and it may take a while for me to finally release this. My new application will be free, and it’s mostly just a practice application in order to improve my skills at coding Android applications and possibly increase my user-base, but I will continue to support it as well as all of my other applications.

Side Project: Command Prompt Alternative

Side Project: Command Prompt Alternative
So today yesterday was my first day back at school. Everything was totally normal, and uninteresting until I got to my first programming class when I immediately noticed something was off… after logging into one of the computers we use for coding projects, I opened the Start menu (yes, these computers are running Windows XP. It sucks, I know.),  and I realized that they removed the “Run” command, which I used all the time, as I’m so used to using the terminal to launch programs in Ubuntu Linux. It’s not that I can’t use a GUI, but it’s so much faster to simply type a command than to navigate through the Applications menu and find what you’re looking for. Especially in the case of certain programs that are console only. Upon further searching through the Start menu, I noticed that NetBeans, an excellent IDE for editing code was missing, which makes no sense, considering the fact that we are in a computer programming class. They do, however, teach us to code Java using Notepad, the worst text editor ever for coding, and command prompt. Honestly that wouldn’t be so bad if Notepad had syntax highlighting, and a half decent (more than 3 edits) undo history. I mean, I edit source code using gedit all the time, and it works great! Regardless of the language, it seems to always know when I want syntax highlighting on or not, mostly by the file extension, and the undo history is superb! Unfortunately this is not the case at all with Notepad. So, guessing that they only removed the “Run” command from the Start menu, I tried opening the shortcut to command prompt from the Accessories folder, which resulted in a rather irritating message saying that the Administrator disabled access to command prompt. Not only do we need command prompt in order to code the way they want us to, command prompt is a very useful tool for power users that allows you to get work done at a much faster rate, as you don’t have to spend as much time searching through cluttered menus and looking for shortcuts. Perhaps this is why I’m so productive when I’m on a Linux machine in the GNOME Desktop Environment… everything feels organized and natural. Even the “Applications Menu” is automatically sorted by category, and there aren’t tons of cluttered folders lined with useless shortcuts like “Uninstall” links. Not that you need uninstall links in Ubuntu, thanks to the wonderful Synaptic package management system. Anyways, since our teacher realized that it was nigh impossible to learn anything, or even get started writing basic programs without a way to compile and test them, we were allowed to play around and do what we want during that time. I decided I’d play with the Python coding language (which they don’t even offer to teach at our school, yet there is a Python IDE installed — imagine that!). In particular, I decided to mess with the ‘subprocess’ packages in Python. After around 15 minutes, I managed to have a shell-based UI that let you enter a command, and returned output when the command finished running. After that, I mostly spend the rest of the time optimizing my code and handling exceptions. Once I got home, I fired up Python, and, as I didn’t have access to any of the code I wrote before, I started the whole thing from scratch, which took much less time, as I already knew what I was doing, and I’m pretty sure my code ended up working better than before, but it was still in a shell, which was unsightly to say the least. So, I did some research into Python-based graphical user interfaces, and I discovered a wonderful little library called “Tkinter”. Not only that, but I also discovered that even though our school has Python 2.5 installed in Windows, which is fairly dated (but not as old as the copy of Visual Studio we have installed — version 6 — which is from 1998), it comes with the Tkinter packages pre-installed. So, I spent a few hours coding, and it finally got to the point where, in terms of GUI, I was very satisfied with what I had, especially considering the fact that I had very little knowledge of Python when I first started coding this, and I knew nothing about Tkinter before today. Once I had the GUI done, porting the logic part of the code was incredibly easy, as I only had to add a few hooks and API calls to the script in order to add event listeners to the GUI and manipulate elements like the scrollbars when the console changes. After several hours of coding, I now have a pretty solid application that just needs a bit more work. Of course, I still have to work on doing other things than running commands like changing the working directory and setting environmental variables (both of which are practically necessary in order to compile and run Java applications), but I’m rather impressed with how versatile and easy to use Tkinter is. I haven’t actually tested this on Windows XP, being an Ubuntu user and all, but I plan on doing so tomorrow. Keep in mind this is an early prototype, and it will probably change a bit over time. This is just a side project, and it shouldn’t get in the way of me developing my other applications, like Clippy, but I will have less time to develop as I’ll be under pressure from my tedious school schedule. But for now, just enjoy the screenshot! 🙂