1. Download our Official Android App: Forums for Android!

Tasker auto-sync problem

Discussion in 'Android Apps & Games' started by renero76, Jul 12, 2016.

  1. renero76

    renero76 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jul 12, 2016

    Jul 12, 2016
    2
    0
    5
    Male
    Dear Tasker users,

    I'm going crazy! [​IMG]
    I recently created a function to turn on wifi and turn off mobile data when there is a near wifi network and viceversa.
    If I launch the app manually it works fine but if I wait it to work it doesn't.
    I controlled the timings in the preferences but the Service Check Milliseconds is 1500 (when display is on), Wifi Scan Seconds are 120, All checks (when display is off) are 240 seconds.
    It seems that the service does not work in background both when phone is locked and when is unlocked.
    It works only sometimes (i can't understand exactly when), probably when is set to active.

    The function is:

    Profile: Known WiFi (3)
    Stato: Near WIFI [ SSID:* MAC:* Functionality:* Minimum activation signal:4 Channel:0 Alternate Wifi off ]
    Start: WiFi And Data (2)
    A1: Delete Notification [ Title: Warn does not exist off ]
    A2: If [ %WIFI ~ off ]
    A3: Run Shell [ Command:svc wifi enable Timeout (Secondi):0 Use Root on Save Result In: Save Errors In: Save Result In: ]
    A4: Wait till [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ] If [ %WIFI ~ on ]
    A5: End If
    A6: If [ %WIFII ~ *CONNECTION* ]
    A7: LED Notification [ Title:WiFi Connected Text:%WIFII Icon:hd_device_access_network_wifi Number:1 Color:Green Evaluate:17 Priority:3 Actions o1) ]
    A8: Notification [ Titolo:%WIFII Testo: Icona:hd_device_access_network_wifi Numero:0 Permanente off Priorità:3 ]
    A9: Run Shell [ Comando:svc data disable Timeout (Secondi):0 Use Root on Save Result In: Save Errors In: Save Results In: ]
    A10: Else
    A11: Run Shell [ Command:svc data enable Timeout (Secondi):0 Use Root on Save Result In: Save Errors In: Save Result In: ]
    A12: LED Notification [ Title:Mobile ON Text:%CELLID Icon:hd_content_import_export Number:1 Color:Red Evaluate:1 Priority:3 ]
    A13: Run Shell [ Command:svc wifi disable Timeout (Seconds):0 Use Root on Save Result In: Save Errors In: Save Result In: ]
    A14: End If

    My android version is 6.0.1.

    The scanning time (when is locked) is 240sec and the service check is 1500 msecs.

    Could you please help me?
     

    Advertisement

  2. Thom

    Thom  
    VIP Member
    Rank:
     #22
    Points:
    1,318
    Posts:
    11,889
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,889
    4,907
    1,318
    Male
    Software Developer
    Keene, NH USA
    Welcome to Android Forums.

    I assume you are root-ed. Correct?

    I don't understand really why you want to toggle Data on/off. If wifi is on then have it take priority. Then all you need to do is toggle wifi on/off.

    The single strangest thing I have ever encountered in Tasker is this one. The reason is unexplainable.

    I have two profiles. If I am within range of my office wifi the office near is in operation. If I am out of range then office far is in operation.

    The entry task of each starts wit a one minute wait. This was done to permit the unexplained coordination to occur. Without it sometimes the coordination would be missed.

    This works (SSIDs chaned) ...

    Profile: tlaOfficeFar
    State: Not Wifi Connected [ SSID:xxxxxxxx1/xxxxxxxx2 MAC:* IP:* ]
    Enter: tlaOfficeFarEnter
    A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
    A2: WiFi [ Set:Off ]

    Profile: tlaOfficeNear
    State: Wifi Near [ SSID:xxxxxxxx1/xxxxxxxx2 MAC:* Capabilities:* Min. Activate Signal Level:4 Channel:0 Toggle Wifi:Off ]
    Enter: tlaOfficeNearEnter
    A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
    A2: WiFi [ Set:On ]

    ... Thom
     
  3. renero76

    renero76 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jul 12, 2016

    Jul 12, 2016
    2
    0
    5
    Male
    Dear Thom,

    Yes I'm rooted.
    The main reason for my profile is that I suppose that if WiFi and Data are functioning at the same moment battery power decreases more rapidly.
    I could use "Smart Wifi" that turn on Wifi when a known network is near but, in this case, Data remain working.

    Do you say that WiFi ON excludes Data, even if is ON?

    Thanks a lot

    Domenico
     
  4. Thom

    Thom  
    VIP Member
    Rank:
     #22
    Points:
    1,318
    Posts:
    11,889
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,889
    4,907
    1,318
    Male
    Software Developer
    Keene, NH USA
    I don't have an answer I would "stake my life on" with regards to your question.

    You are on a root-ed device. I have no idea what hardware/firmware/software you are using. It may be different from what I am using.

    I suggest you change the SSIDs in the code I provided and try running it on your device.

    The obscurity is the one minute wait at the start of each task to permit syncing. This might be the solution to your problem.

    ... Thom
     

Share This Page

Loading...