Posts Tagged ‘ Android ’

Is there an Android API for Google Maps 5.0?

I’ve been looking for this for some personal projects today. After a few hours of research and testing on 3/29/2011, my definitive answer is no.

There remains an unanswered comment on the official blog post about it here from December, and when using the latest 2.3.3 Google APIs in the SDK, I still receive tile based maps. I have also found numerous unanswered questions from stackoverflow and other QA sites to back up my statement that it is currently unavailable.

I will update this post when the Maps 5.0 API becomes updated, or if anyone hears otherwise before I do, please comment!

Golden AP Gets to shine a little brighter today as well…

We don’t get too many downloads on Mobile AP Gold, and thats ok! The whole reason we made Mobile AP Shortcut to begin with is because we wanted everyone to have 1 button access to turn on Mobile AP! But, our select few gold members, we do love you, so Golden AP has been updated with slight differences from Mobile AP, to make sure you feel the distinction.

The largest distinction is we left the shortcut itself as an app, and slightly changed its icon to reflect its functionality. The widget in Golden AP is a 1×1 instead of a 2×1, and its only function is for one button enabling / disabling your mobile hotspot. This way if you don’t want the settings shortcut tacked on, you don’t have to. And of course, there is no 5 second ad delay (we’re bastards, we know).

Check out the screenshots and the table below, choose for yourself!

Whats the big difference anyways?! Golden AP Mobile AP
Access to Mobile AP Settings on all compatible phones: Yes Yes
Access to 1 touch enable on all compatible phones: Yes Yes
Sweet Gold Icon Yes No
Has ads No Yes
Widget Size 1×1 2×1
Has Shitty Graphics Yes Yes
Buys us 1 cup of ramen: Yes If you click the ad 69 times

You can buy Golden AP here for only $.99 USD.

-Kevin Grant

Android Apps: Golden / Mobile AP Shortcut 3.0 is here!

We are proud to announce Golden and Mobile AP Shortcut 3.0! We skipped 2.0 because we felt like it! After hours of laboring, we have figured out how to turn this handy dandy application from a helpful shortcut to an AMAZING WIDGET! Check out the screens below, and head to marketplace for Golden AP Shortcut for the paid version or Mobile AP Shortcut for the ad version.

-Kevin Grant

Android: What does “Volatile” mean?

At work, I’m currently working on a very large project, and a lot of it was previously written by some very experienced programmers, far beyond my level of skill. When I read through it, I often come across weird things I’ve never seen before (a lot of which gives me the content to post here!) One of these I cam across recently was this word:

volatile

Its a strange prefix to a variable name, and the first few times I looked it up, I was not able to find a clear or concise answer. When I try to compile it into simple programs, it never yielded any visible differences. I have found this article from Javamex which put together a rather simple table and explanation of what it actually does.

Essentially, volatile is used to indicate that a variable’s value will be modified by different threads.

Briefly, I can tell you it is related to threads and synchronization, so if your programs don’t have a lot of multi thread functionality, this keyword *probably doesn’t affect you. Check out the article here and feel free to toss in any comments to shed light some more light for our readers!

-Kevin Grant

Texas dialR update

We’ve added three new stickers to Texas dialR!

See the new stickers on the dialR Facebook Page and get the update in the marketplace.

Android: Getting screen pixel size and dimensions

In one of our programs, I hackishly figured out how to get screen size based off of measuring a view in the onDraw() method and only doing it the first onDraw, and blah yada blah etc. This was terrible and I knew it from the beginning, but it works, so whatever. However, I have run into the same problem into a different project and that method won’t work here, so I researched it again. Low and behold, it was much easier that I ever thought (just like everything else).

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);

and now you can access everything you want through this “metrics” variable. Found this right on the android site under Display Metrics

-Kevin Grant

Android: Ain’t no Callerback grl… (Callback functions in Android)

When I learned about callback functions in Android, it literally created a whole new world of possibilities of what I could do withing my apps. For so long I had used callback functions without even knowing it! An example of a callback function we all already use is with buttons and the onClickListener(). Usually when you create a button, you register a listener, and then you put code into it, like so:

Button btn = (Button) findViewById(yada_yada_yada);
btn.setOnclickListener(new OnClickListener(){
	@Override
	public void onClick(View v){
		// do something
	}
});

Basically, whenever you press a button, it sends a callback to this listener you set, and your program can do whatever you want in here. What we want to do now is replicate this sort of callback, but not for a button press. We want to replicate this for ANYTHING! In the example code I provide, we can now do things like this:

rst = new RandomSenderThingy();
rst.setRandomThingyListener(new RandomSenderThingyListener(){
	@Override
	public void onBoolThingChanged(boolean changed) {
		Log.d("DEBUG","Callback Received! It is: " + changed);
	}
});

The example code makes use of a few various techniques to get the point across, but I’ve clearly commented the parts that you will need to inject into your own code to get this functionality. Good luck and post any questions or comments in the comments section!

Download the source code here

-Kevin Grant

Android: Debug certificate expired

Have you received this error?

Error generating final archive: Debug Certificate expired on 2/9/2011 11:55 PM

I just got it today! The fix is quite simple, just locate your debug.keystore file, delete it, and and then select “clean all projects” in eclipse. I followed this brief tutorial from a guy over at “The Java Dude”.

Check out his tutorial here

-Kevin Grant

Formatting and Styling Strings (Java/Android)

So, let’s say you’re reading the Android document on formatting and styling strings and come across the line

Hello, %1$s! You have %2$d new messages.

The document explains that %1$s and %2$d are a string and decimal value, respectively. The next chunk of code is

String text = String.format(res.getString(R.string.welcome_messages), username, mailCount);

Now, how does this relate? Well, the 1$ and 2$ means first and second parameter, respectively. So in this case %1$s is replaced with the variable username and %2$d is replaced with mailCount.

Why should you construct strings this way instead of constructing a string with the plus sign? Well, either way is valid, but this is just the “old” way of constructing strings. There was a time where using the plus sign to construct strings required converting decimal numbers to a string or else the compiler would complain. It was an obnoxious intermediate step. With Java though, the plus sign is smart enough to change the datatype of a decimal to a string if the rest of the line contains strings. To make a string (that contains a number) to a decimal, just add “+ 0” to the end and Java will take care of it. Pretty slick, right?

Services and notifications, just what you always wanted!

So have you ever wondered how to get a cool notification to show up in your app for something? Or have you ever wanted to know what a “service” in android was, or just something as simple as seeing some basic, example, skeleton code with some intuitive comments and variable names? Well, thats what I have produced for you! Some of this was copied from the Android site, some of this was created by some friends of mine, but all in all, its very basic stuff.

Download the code here. Just create a new project based off of this file and go nuts! The screenshots below show what it should generally look like when you run it!

Services are a great way to add some background processing to your applications. Services can almost be thought of as an Activity (which is what normal android programs are) but without a user interface. This means everything it does is in the background! Have a background service that sends a text message to your friend every 10 minutes, or have a service that creates a toast every 15 minutes to remind you how awesome you really are. This skeleton code gives you the framework to do just that!

If you found this example helpful, or would like to share how you utilized this in your own programs, post in the comments below, can’t wait to hear!

-Kevin Grant