Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

In Tasker, I have created a profile to open a URL when I visit certain place during certain time. It works.. When conditions are met, my default web browser (Dolphin) is opened to handle that URL visit.

I have setup another profile to kill Dolphin when I leave that place or time duration ends (whichever comes first).

Now, I want to make logic flow more complex: If URL fails to load, don't kill Dolphin.

How to check that URL was opened successfully or not? The rest I can do by myself.

share|improve this question
add comment

1 Answer

You could use an "HTTP Get" action to query the site. The response code sent back by the website is stored in the %HTTPR variable. So %HTTPR = 200 means the site loaded sucessfully. You can then make the rest of your task conditional on that variable, eg. IF %HTTPR = 200 THEN Go Home (or however you are "closing" Dolphin). I know that %HTTPR is dependent on the mime type of the HTTP Get request so you'll have to tweak that a bit, and you may choose to look for different response codes to trigger different actions.

There's probably other ways to do it but it would depend on the site you are trying to reach.

share|improve this answer
    
This is just like pinging web service status of server. I need to open webpage so that I could see it. –  Sachin Shekhar Apr 7 '12 at 0:11
    
Yes I realize that and assumed that you were doing that with the "Browse URL" action. The HTTP Get action would be a separate action and while it is not exactly checking to see if the site loaded in the Dolphin browser, it stands to reason that if you are opening google.com in a browser and at the same time you send an HTTP Get request google.com and get the proper response, it probably loaded in the browser with no problem. I'm not aware of any scenario where Tasker could communicate with the server but Dolphin can't. –  Matt Apr 7 '12 at 3:18
    
There may be other ways to do what you want to do but I'd have to know more about the site(s) you that you'll be loading and how Tasker could interact with them before I could offer and other suggestions. –  Matt Apr 7 '12 at 3:19
    
Its my own website with plain HTML generated by PHP after fetching data from MySQL database. Please, advise. GET method is fine, but its not the reliable way. –  Sachin Shekhar Apr 7 '12 at 7:02
1  
How about having your site load a cookie and then use the Test action to check for the specific cookie file. I'm not sure where cookies are stored but you'll probably have to be rooted. –  Matt Apr 7 '12 at 13:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.