top | item 7843664

Show HN: I built an Android live wallpaper with Scala – now it's free

64 points| nilium | 11 years ago |play.google.com

38 comments

order

yRetsyM|11 years ago

Great work nilium. I always wanna try one of these but I worry about battery life - how does everyone find these live wallpapers affect the performance of their batteries?

eco|11 years ago

I've never found they affect my battery life noticeably but I don't spend much time staring at my home screen[1]. Maybe some people do but my home screen is for quick access to information and launching off point for other apps so it doesn't get all that much screen time (and the live wallpaper isn't just running in the background).

1. Ok, that's a lie. When that live wallpaper that has an AI Super Mario that plays never ending levels came out I spent a lot of time looking at it and showing it to people. My Motorola Droid's battery didn't stand a chance.

readme|11 years ago

I just bought an extended life battery the size of a brick, so I'm not incredibly worried!

wiradikusuma|11 years ago

I'm writing Android app as well, using Scala. Do you have sbt script and/or ProGuard config that you can share?

nilium|11 years ago

The only thing I can imagine would be relevant is that I'm using pfn's android-sdk-plugin.[1] I also have a sort of generic build.scala file I tend to reuse for Android projects (it's based partly on Ascension's, but has been tweaked a bit), which may also be useful.[2] I leave most of the proguard configuration up to pfn's sbt plugin since it does an acceptable job, but your mileage may vary.

[1]: https://github.com/pfn/android-sdk-plugin/

[2]: https://gist.github.com/nilium/db5bfac2174370ebdd97

yareally|11 years ago

If you don't need the sbt build system for your project, it's pretty simple to get started. Here's my guide (and some code examples) for using just proguard + Intellij. Using sbt isn't difficult to set up either, though I consider it a bit overkill for smaller projects/scripting.

https://github.com/yareally/android-scala-intellij-no-sbt-pl...

beanholio|11 years ago

Thank you for making this compatible with Android 4.1.2. Because of bluetooth issues, I switched my Xperia T back from 4.3 to 4.1.2, and I've been missing all the cool 4.3 Xperia wallpapers. I'm running "Glitch" Config with "Blueshift" Gradient, all other settings defaulted. Gonna stare at it for a few hours.

nilium|11 years ago

This actually made me aware of a bug in the last release that I just released a patch for, so that was fun. I guess nobody ever reported (or encountered? seems unlikely though) the issue until I got a crash report for it today.

morenoh149|11 years ago

dude this is so cool. So scala can compile to the jvm right?

nilium|11 years ago

It'll compile to JVM bytecode. I believe it also compiles to Javascript (I'm not sure if this is still considered experimental — I haven't looked in a while), which is pretty cool. I think it used to also target the .NET CLI as an experiment, but I'm pretty sure that's no longer a goal.

The important thing for me was that it compiles to JVM bytecode that's compatible with Java 1.6, so the resulting code can all be converted to Dalvik fairly quickly. The main downside right now is that you have to heavily prune the Scala stdlib, since it's packed with tons of methods and dex has a 16-bit method limit[1] — and you will hit it if you don't prune it (using proguard or another tool of your choice).

[1]: https://code.google.com/p/android/issues/detail?id=7147#c6

yareally|11 years ago

On Android, Scala gets compiled to dex bytecode just the same as Java. Scala has slightly more overhead though from making lots of small objects, but the tradeoff is worth it if you prefer not using Java.

I stick to using Java Collections (and the special ones Android provides[1]) most of the time to avoid excess overhead, but it still results in much more concise code than what I would write in Java. One of most compelling reasons to use Scala though is it's much easier to deal with asynchronous processing (via actors, futures, async/await[2]) than the messes you end up with using AsyncTask + callbacks with Java.

[1] http://developer.android.com/reference/android/support/v4/ut...

[2] http://docs.scala-lang.org/sips/pending/async.html

SyncTheory13|11 years ago

I've had my Nexus 5 since it came out and haven't changed the background from stock... This is the first one I've seen that has gotten me excited. It's so versatile.

Thanks a lot! Good work!

reedlaw|11 years ago

This is very nice looking, although the initial settings were too fast and made it a bit distracting. I've stuck with the default live wallpaper that came with my Nexus 4 until now.

nilium|11 years ago

Thanks! I agree on the speed, though it's kind of set in stone for the most part since that was the default when I first released the app. I'd love to go in and make a mess of the project by rewriting things and changing all the defaults, but now that I have a small amount of users, it sort of behooves me not to do what I'd do with my other personal projects.

That also makes it difficult to introduce new features since I can't just switch them on and I don't really want to pester users about it. Not entirely sure how to handle that yet, but I've been focusing on other personal projects and job hunting. Worrying about adding stuff to Ascension hasn't been a huge concern. It does what I want, so I haven't found anything else I'd like to add to it just yet.

jevinskie|11 years ago

I felt that 30 FPS was too choppy when moving left-right between home screens. 60 FPS works well. "Glass" is deliciously retro.

I actually liked a faster "wave propagation" speed.

All personal taste though, which Android excels at. =)

Cthulhu_|11 years ago

Looks nice, although I wonder how to configure it? There's an app that appeared, but when I click it I get an 'app not installed' error / toast message.

duncancarroll|11 years ago

This is pretty impressive work--thanks for sharing!

GhotiFish|11 years ago

Huh, it doesn't support my device, do you have screen size requirements?

edit: never mind, you block galaxy nexus for performance reasons.

awwww :(

ewzimm|11 years ago

Thanks. I'm using your Orion config with random widths. The smoother gradient transitions are especially nice.

deepsun|11 years ago

Is it open-source?

nilium|11 years ago

Not at the moment. Still undecided on that.

bowmanb|11 years ago

This makes for a sweet wallpaper! Nicely done.

readme|11 years ago

will the app truly not run on a galaxy nexus or is minSdk set too high?

nilium|11 years ago

I currently don't allow installation on the Galaxy Nexus because for some reason the live wallpaper has severe performance issues on Galaxy Nexus devices. I've never been able to figure out what the problem is, since it's obviously not hardware — older devices run it fine. My best guesses are that I'm doing something out of the ordinary in GL ES that I haven't noticed or that there are either driver issues (not necessarily buggy drivers) or those specific devices have something off about their GL interfaces. It's hard to say without having a device on hand for it, which I don't. I'm mostly leaning toward it being an issue with how I use GL.

Because of the issues, I decided it was better to just block the device entirely rather than have people suffer through the performance issues with the Galaxy Nexus.

errorrrr|11 years ago

that's actually nice wallpaper, thank you!