- Home
- Coding concepts
- Special screens
- Available features
- More
- Translation
- Testing
- Deployment
- Differences in Locify 0.8.5
- Sample services
- Example videos
Twitter for Locify
There have been some changes in format for older versions of Locify.
See documentation for Locify 0.8.1 and older.
If you plan support for versions older than 0.8.5, you need to detect client version and serve correct screen.
This sample service allows user to save his updates on Twitter with GPS position. It also supports viewing public, user and friend timelines, favorite updates and account information using internal browser. It supports authentication to Twitter and uses settings for saving item count and default adding gps coordinates to statuses.
Welcome message
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Twitter for Locify</title> </head> <body class="serviceInfo"> <div> <p class="description">Updating your status on Twitter has never been simpler. This service allows you to send and receive Twitter status updates.</p> <img src="http://www.locify.com/images/socialicons/twitter.png" class="icon" alt="" /> <a href="http://services.locify.com/twitter/start" class="firstScreen">firstScreen</a> <a href="http://services.locify.com/twitter/settings" class="settings">settings</a> </div> </body> </html>
Settings screen
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Twitter settings</title> </head> <body class="form"> <form action="locify://serviceSettings" method="post"> <locify:variables> <locify:element name="itemCount" value="$settings[itemCount]" /> <locify:element name="addgps" value="$settings[addgps]" /> </locify:variables> <fieldset> <label>Displayed items (1-20): <input type="text" name="itemCount" value="" /></label><br /> <label>Add GPS coordinates: <select name="addgps"> <option value="1">yes</option> <option value="0">no</option> </select></label><br /> <input type="submit" value="Save" /> </fieldset> </form> </body> </html>
First screen
Action open is described below.
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Twitter for Locify</title> </head> <body class="list"> <ul> <li><a href="http://services.locify.com/twitter/postform" class="listItem">Update status</a></li> <li><a href="http://services.locify.com/twitter/timelines" class="listItem">Timelines</a></li> <li><a href="http://services.locify.com/twitter/open?view=favorites&count=$settings[itemCount]" class="listItem">Favorites</a></li> <li><a href="http://services.locify.com/twitter/account" class="listItem">Account</a></li> <li><a href="http://services.locify.com/twitter/login" class="listItem">Sign in</a></li> </ul> </body> </html>
Update status
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Twitter for Locify</title> </head> <body class="form"> <form action="http://labs.locify.com/twitter/post" method="post"> <locify:variables> <locify:element name="lat" value="$lat" /> <locify:element name="lon" value="$lon" /> <locify:element name="addgps" value="$settings[addgps]" /> </locify:variables> <fieldset> <label>Status: <input type="text" name="status" value="" /></label><br /> <input type="submit" value="Update" /><br /> <label>Add GPS coords: <select name="addgps"> <option value="1">yes</option> <option value="0">no</option> </select></label><br /> <label>Lat: <input type="text" name="lat" value="" /></label><br /> <label>Lon: <input type="text" name="lon" value="" /></label> </fieldset> </form> </body> </html>
Answer after update status
In case user is not logged a 401 HTTP status is returned and user login screen shows up. In case everything is OK, this alert shows up (alert is also used for some error messages):<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Info</title> </head> <body class="alert"> <div> <p class="text">Your Twitter status has been updated.</p> <a href="http://services.locify.com/twitter/start" class="next">next</a> <locify:timeout value="3000" /> </div> </body> </html>
Timelines
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Twitter Timelines</title> </head> <body class="list"> <ul> <li><a href="http://services.locify.com/twitter/open?view=publictl&count=$settings[itemCount]" class="listItem">Public</a></li> <li><a href="http://services.locify.com/twitter/open?view=friendstl&count=$settings[itemCount]" class="listItem">Friends</a></li> <li><a href="http://services.locify.com/twitter/open?view=usertl&count=$settings[itemCount]" class="listItem">User</a></li> <li><a href="http://services.locify.com/twitter/start" class="listItem">Back to Twitter menu</a></li> </ul> </body> </html>
Other
After selecting one of the Timelines, Favorites or Account, internal browser is called. Regular XHTML with links, images etc. is used. After selecting Sign in, server checks if user is logged in and if not, HTTP status 401 is sent back.How does it look like
You need Flash Player and JavaScript to see video content.
