Developers
AvantGo Channel Developer Guide

TOC PREV NEXT INDEX


Adding any web page to user's mobile device with a simple link

Suppose that you want to include a link on every page of your website that says, "Download this page to my mobile device!" It is actually a fairly easy process. Just include a link in the following format:

  

<a href="http://avantgo.com/mydevice/autoadd.html

?title=Recipe:%20Baked%20Alaska

&url=http://www.mywebsite.com/recipes/alaska/index.html

&max=100&depth=1&images=0&links=0&refresh=hourly

&hours=1&dflags=127&hour=0&quarter=00&s=00">

Download this page to my mobile device!</a>

  

Note: The above URL is broken into several lines for the sake of readability. You should have your link all in one line.

This will create a custom channel in the same way as if you were using the "Create Custom Channel" link from the AvantGo accounts page. Take a closer look at this link:

  • http://avantgo.com/mydevice/autoadd.html
  • This is the link to the AvantGo service's "add a page that is in our AvantGo channel database" form.

  • ?title=Recipe:%20Baked%20Alaska
  • This parameter describes the title of your page as it will appear in the AvantGo Client.

  • &url=http://www.mywebsite.com/recipes/Alaska/index.html
  • This parameter indicates the URL of the page you would like to link to. Again, if there are any ampersands, equals, space, or quotation marks within your url, you probably want to escape them.

    Note: Since the time of this writing, we have upgraded our autoadd.html link to become much smarter at dealing with ampersands and equal signs in the middle of a URL. But I recommend escaping them anyway.

  • &max=100
  • This is the maximum size of the channel (in kilobytes). I recommend keeping this at around 100.

  • &depth=1
  • This is the number of links you want the AvantGo sync server to traverse when grabbing your page as a channel.

  • &images=0
  • This is a boolean value (1=true, 0=false) saying whether or not you want the AvantGo sync server to grab images from your page. Since you will be using this link to download an ordinary web page (as opposed to an optimized AvantGo channel) most of your images are probably not tailored to a mobile device. So you might want to consider leaving this set to 0.

  • &links=0
  • This is a Boolean value asking if you want the AvantGo sync server to follow off-site links. You probably do not.

  • &refresh=hourly
  • This is a variable describing how often you want the AvantGo sync server to re-download the page. Choices are:

    • always - Download the page very time the user syncs
    • hourly - Refresh the page after a set number of hours
    • once - Only download the page once
    • daily - Refresh the page on certain days at a set time
  • &hours=1
  • If your refresh value is set to hourly, this value determines how many hours need to elapse for the AvantGo sync server to download the page again.

  • &deflags=127
  • If your refresh value is set to daily this value determines which days the AvantGo sync server will refresh the channel. It is a simple sum of values where:

    • Sunday = 64
    • Monday = 32
    • Tuesday = 16
    • Wednesday = 8
    • Thursday = 4
    • Friday = 2
    • Saturday = 1

      (If your refresh value is not set to daily this value is ignored)

  • &hour=0&quarter=00&s=00
  • If your refresh value is set to daily this value determines what time the AvantGo sync server will refresh the channel: hour = hours, quarter = minutes, s=seconds.

    We use a 24-hour format and round to the nearest 15-minute interval, so &hour=0&quarter=00&s=00 is midnight, and &hour=16&quarter=34&s=55 is 4:30 in the afternoon.

Once a user has clicked on this link, (assuming he has logged in to his AvantGo account) he will see a page that looks something like Figure 9-3:

Figure 9-3 Channel Properties Review page

 

Note: The custom channel function is intended for personal, non-commercial use. If you are creating a custom channel for any other purpose, you must review our Custom Channel policy at:

http://avantgo.custhelp.com/

 

The user needs to click on the Save Channel button in order to complete the transaction.

 

Note that there are a few disadvantages to this approach as opposed to using the _add_channel.pl script to add a channel:

  • The user has to complete the process by pressing the Save Channel button.
  • You cannot include any cookie information with this link.
  • You cannot make a global change to every user subscribed with the autoadd.html method.
  • When the process is complete, the AvantGo Client does not take the user back to the referring page. So you might want to make this link open up in a new window.

But when it comes to being able to add any web page to a user's mobile device, this is the simplest way to go. 



TOC PREV NEXT INDEX