Developers! Integrate your app with JuiceDefender

We Android developers strive to help our users become more and more awesome - they deserve the best tools! We have the privilege of working on this amazing platform that allows apps, among other neat things, to talk to each other and work in synergy, and of course many apps working together can do so much more than any single app could ever hope to accomplish - ladies and gentlemen, the network effect!

So if you're developing an app to keep mobile data usage quota under control, or to automate common operations, or to help users manage the complexity of their phones, or to do something entirely different that I cannot even imagine, why not add JuiceDefender's capabilities to your feature list?



JuiceDefender allows 3rd party apps to interact with its engine; right now this is only about enabling/disabling mobile data, but it's just the beginning!

[Warning: devs-only stuff below :) ]

The thing works via broadcast intents; JD responds to four of them:
  • com.latedroid.juicedefender.action.ENABLE_APN will 'force enable' mobile data even in situations where JD would normally keep it disabled
  • com.latedroid.juicedefender.action.DISABLE_APN the opposite of the aforementioned one, this will 'force disable' mobile data
  • com.latedroid.juicedefender.action.ALLOW_APN will restore mobile data to its previous state (usually, letting it be controlled by JD)
  • com.latedroid.juicedefender.action.REQUEST_APN_STATUS - see below

Sending these broadcasts is done thusly:
context.sendBroadcast(new Intent(ACTION_DISABLE_APN).putExtra("tag",
"yourappname").putExtra("reply",true));


The tag extra is a short (6/12 characters) string of your app's name - so the user can keep track of what's going on on JD's Toggle mobile data widget and in the log.

The reply extra is optional; if provided and set to true, it'll trigger an immediate reply broadcast with the new status; you can also request the current status at any time via REQUEST_APN_STATUS (include the tag extra) - to the same effect.

The reply itself will be another broadcast intent (com.latedroid.juicedefender.action.REPLY_APN_STATUS) with the current status for your app - so your app needs to register a receiver for the reply intent - either via the manifest or at runtime with registerReceiver(). It'll include two String extras: tag will hold your app name - to check whether the request was triggered by your app - and app will hold the current status for the given tag - it can be enable, disable, or allow.

Note that these intents will work even when JD is disabled, and that the Toggle mobile data widget (a.k.a. the user) always has the precedence - if she manually disables mobile data, it'll stay disabled no matter what.


Let's get the network-of-apps started (and stay tuned for more)!
ShareThis

3 comments:

tomash | July 7, 2010 at 2:09 PM

Would you like to provide UltimateJuice for developers which integrate own applications with JD?

Anonymous | July 16, 2010 at 6:38 AM

I noticed 3G watchdog uses your app to block 3G access when you have reached your quota, but I can't see any mention of it on your site. Is there a list of apps that interface with JuiceDefender?

Anonymous | July 16, 2010 at 6:47 AM

... until I re-read your post and noticed the links that go to apps that are juice integrated, but a list might help for all the other apps that are bound to integrate with JuiceDefender.

Post a Comment

Note: Only a member of this blog may post a comment.