Settings

Theme

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

play.google.com

64 points by nilium 12 years ago · 39 comments

Reader

yRetsyM 12 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 12 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.

    • niliumOP 12 years ago

      I admit to doing the same thing with the Super Mario live wallpaper, and with a Droid 1. It ruined my battery, but it was worth it. I remember being able to turn on some switch that'd get it to display the path it was taking through a level, which was really cool to me. I miss that live wallpaper — the Droid less so (even though it's sitting on my desk because it's the only thing I have running Android 2.x).

      Besides that, my argument is that if a you spend a lot of time in your launcher, it might affect battery life in a somewhat noticeable way. Typical usage should have you in another app most of the time, but that's speculation on my part. I could imagine folks using their launchers a whole lot if they were packed with widgets that did more than just display things, but I've never had a lot of luck finding widgets I liked. Ultimately, if you or anyone else is concerned about squeezing every possible minute out of your battery, your best bet might be to have a solid black static wallpaper. Mostly comes down to priorities.

      Edit: http://android.ccpcreations.com/mariolive ⇐ I think that might be the same live wallpaper from back then? Can't verify it right now, and I'm wary of installing foreign APKs these days, so exercise caution.

  • readme 12 years ago

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

wiradikusuma 12 years ago

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

beanholio 12 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.

  • niliumOP 12 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 12 years ago

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

  • niliumOP 12 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 12 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

    • niliumOP 12 years ago

      > Scala has slightly more overhead though from making lots of small objects

      This is definitely true, though it's possible to write code that avoids it. It just ends up being slightly uglier Scala. The renderer in Ascension, for example, is all fairly bare-bones Java-like Scala because I have to be careful about how certain code is generated (i.e., prefer a while loop or tail recursion to a for comprehension or .foreach). So, it's possible to get performant code, it just ends up being more like Java usually.

      In the UI code, you can get away with a little more depending on where it is. If it's inside an adapter, it pays to avoid the heavier tools Scala gives you. If it's responding to a button press, you probably don't need to worry as much. The GC will run a little more often, but the GC in Android has improved a fair bit over time.

      I'll second the Java collections recommendation though — as much as I like the immutable collections provided by Scala (and I do use a few of them), they're much free-er with their allocations than Java and Android's. I haven't tried anything with actors on Android yet, though, so I can't comment on that. I just use AsyncTask as carefully as possible right now, but I really need to get familiar with an alternative to that. I'd like to try actors, plus I'd also like to get into using something like RxJava/Scala, but I haven't had anything come up where I could afford to experiment with it. Also need to see how Akka fares on Android, but same problem as RxJ/S.

SyncTheory13 12 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 12 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.

  • niliumOP 12 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 12 years ago

      Could you have "Classic" (current) and "Remixed" (tweaked) versions of the current presets?

  • jevinskie 12 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_ 12 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 12 years ago

This is pretty impressive work--thanks for sharing!

GhotiFish 12 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 12 years ago

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

deepsun 12 years ago

Is it open-source?

  • niliumOP 12 years ago

    Not at the moment. Still undecided on that.

    • mkesper 12 years ago

      Why not? Might get more people using Scala for Android development.

      • niliumOP 12 years ago

        It's code I've invested a lot of time in, but was never written with the idea that other people would see it, so 75% worried at how horrifying the code might be and 25% worried that someone might make a build and push a clone out with malware attached.

        • lmm 12 years ago

          For the 75%: It's still useful and will be appreciated, even if there might be mean people out there. Much better to see code than no code.

          For the 25%: wouldn't they just decompile the current version?

        • tomswartz07 12 years ago

          To allay your fears about the 75%: that's what code review is for. Lots of eyes make the problematic code go away. :)

          I'd be more than happy to help de-spaghetti the code if it was available.

          • niliumOP 12 years ago

            Currently working on another patch to fix some newfound crashes while prepping the code for open sourcing. License headers and all that.

            Plan for now is to release it under the GPL version 2 or 3 to hopefully compel people to make their modifications available (plus there's not much use for a lenient license here -- it's not a library, though some of the code could be moved to one later). This might take a day or so, so I expect this post to disappear into complete obscurity before I'm done. Might create a new HN submission for that just to let people know. At any rate, my net access is down so I have to write this on my phone, meaning any release is going to wait on my ISP to determine what's up and how to resolve the issue.

            So, open source is planned, I'll just suck it up as I usually do when I release every other project of mine. Re: malware, I've decided it's not my responsibility to protect people from the malicious few. I'll let Google do that.

        • GhotiFish 12 years ago

          re 75%, don't be so bashful, that sounds like an opportunity to learn.

          but I understand the 25% bit. It's a shame the android market is so hostile.

bowmanb 12 years ago

This makes for a sweet wallpaper! Nicely done.

readme 12 years ago

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

  • niliumOP 12 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.

    • stuaxo 12 years ago

      Gah, first time I did android it was live wallpaper, client got me a samsung, which just happened to not come with live wallpaper functionality, what a faf !

errorrrr 12 years ago

that's actually nice wallpaper, thank you!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection