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_APNwill 'force enable' mobile data even in situations where JD would normally keep it disabled
com.latedroid.juicedefender.action.DISABLE_APNthe opposite of the aforementioned one, this will 'force disable' mobile data
com.latedroid.juicedefender.action.ALLOW_APNwill 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:
tagextra 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.
replyextra 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
tagextra) - 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:
tagwill hold your app name - to check whether the request was triggered by your app - and
appwill hold the current status for the given tag - it can be
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