Wednesday, September 19, 2012

Convert desktop version of website to mobile site

Google has start a new application GOMO for convert your existing desktop web application version to mobile version.

Google has made collaboration with dudaMobile. It is very exiting application for Google.
The application is convert desktop version website in mobile website within few seconds.

  • Application not only convert site in to mobile version user can also select the theme for the mobile application.
  • User can edit/delete the content from the mobile application.
  • User can customize contains for mobile site.
  • Not only this Google is also providing free hosting for the site for a year.
  • User can also take free help from support team for a year.
Those all facility provide to only attract most of the individual/ organization to once convert their site into mobile application but it also has some drawbacks.

  • Your desktop site should be well designed before mobile conversion.
  • The application will convert all site in to mobile version it include each and every link which may not require for the mobile site and it may create extra load for the mobile application.
  • This application may not work on lower end mobile device or older smart phone.
so in conclusion I can say that this is best opportunity for individuals and organization who has their static site and want to develop mobile site, but for a well organize site or for dynamic site this is not a good choice.


Sunday, September 2, 2012

HTML5 Geolocation for Mobile

HTML 5 is develop not only to target desktop but also to target every device which can access internet like Mobile, Smart TV, Gaming console etc.

HTML 5 Geolocation  can be use with Mobile to develop various application, before this native application is the only way to develop Geolocation application of course developer can access the native features of Mobile device using Phonegap

With HTML5 it is possible to get as accurate geolocation information as device native application give. actually it is using different algorithms to get geolocation coordinate information. Developer can get accurate coordinate information of end user by using "enableHighAccuracy "  option.   

The navigator.geolocation object offers is quite small but offers the following (at the time of writing):

  1. void navigator.geolocation.getCurrentPosition(success_callback_function, error_callback_function, position_options)
  2. long navigator.geolocation.watchPosition(success_callback_function, error_callback_function, position_options)
  3. void navigator.geolocation.clearWatch(watch_position_id)
position_options is specified as a JSON-style string with up to three parameters:

  • enableHighAccuracy – A boolean (true/false) which indicates to the device that you wish to obtain it’s most accurate readings (this parameter may or may not make a difference, depending on your hardware)
  • maximumAge – The maximum age (in milliseconds) of the reading (this is appropriate as the device may cache readings to save power and/or bandwidth)
  • timeout – The maximum time (in milliseconds) for which you are prepared to allow the device to try to obtain a Geo location

wpid=navigator.geolocation.watchPosition(geo_success, geo_error, {enableHighAccuracy:true, maximumAge:30000, timeout:27000});

The success_callback_function is passed a single parameter, a position object which has the following properties:

  • coords.latitude – The current latitude reading
  • coords.longitude – The current longitude reading
  • coords.accuracy – The accuracy of the current latitude and longitude readings (in metres)
  • coords.speed – The current speed reading in metres per second (you can simply multiply by 2.2369 to convert to miles per hour or multiply by 3.6 to convert to kilometres per hour)
  • coords.altitude – The current altitude reading (in metres)
  • coords.altitudeAccuracy – The accuracy of the current altitude reading (in metres)

here we take a look of simple example

Example of a "one-shot" position request.

    function showMap(position) {
      // Show a map centered at (position.coords.latitude, position.coords.longitude).

    // One-shot position request.

you can use above example when developer want to use geolocation information once in a code

Example of requesting repeated position updates and handling errors.

    function scrollMap(position) {
      // Scrolls the map so that it is centered at (position.coords.latitude, position.coords.longitude).

    function handleError(error) {
      // Update a div element with error.message.

    // Request repeated updates.
    var watchId = navigator.geolocation.watchPosition(scrollMap, handleError);

    function buttonClickHandler() {
      // Cancel the updates when the user clicks a button.

Example of requesting a potentially cached position.

    // Request a position. We accept positions whose age is not
    // greater than 10 minutes. If the user agent does not have a
    // fresh enough cached position object, it will automatically
    // acquire a new one.

    function successCallback(position) {
      // By using the 'maximumAge' option above, the position
      // object is guaranteed to be at most 10 minutes old.

    function errorCallback(error) {
      // Update a div element with error.message.

Difference between  getCurrentPosition() and watchPosition()

The getCurrentPosition() method takes one, two or three arguments. When called, it must immediately return and then asynchronously attempt to obtain the current location of the device

The watchPosition() is doing  same but, The watch operation then must continue to monitor the position of the device and invoke the appropriate callback every time this position changes

Reference :