Thursday, April 28, 2011

Re: [android-developers] Creating a background running service to auto turn on/off auto sync when wifi is turned on/off

On Thu, Apr 28, 2011 at 1:18 PM, Omkar <omkar.ghaisas@gmail.com> wrote:
> Hi,
>    I want to create a background running service which will get auto
> triggered and then set background data and sync property on / off
> automatically when wifi is set on / off.
>
> So basically I need a no UI service which will set background data and
> sync properties on / off depending on whether Wifi is turned on / off.
> The service need not be constantly running / started at boot time, if
> there are other alternatives to starting the same.
>
> Pls guide, if this is possible in Android (specifically Froyo and and
> above) and basic steps to do so.

I did something like this using "on device-added-*" and "on
device-removed-*" triggers in init.rc.

In init.rc -->

service xyz /system/bin/xyz
disabled

on device-added-/dev/<wlan_dev_node>
xyz start

on device-removed-/dev/<wlan_dev_node>
xyz stop

Regards,
Amit Pundir

>
> Thanks
> Omkar
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment