Giter VIP home page Giter VIP logo

sample-geolocation's Introduction

Geolocation

Try in AppBuilder Get from GitHub

Overview

This sample shows you how to use the Geolocation API to get geolocation information about a device from the device GPS, network IP address, RFID, WiFi and Bluetooth MAC address and GSM/CDMA cell IDs.

Supported mobile platforms: iOS, Android, Windows Phone

Developed with: Apache Cordova 3.7.0

Back to Top

Showcased APIs

This sample shows how to use the following methods of the Geolocation API.

  • getCurrentPosition(): Returns the position of the device to the success handler as a Position object. If the retrieval of geolocation information is unsuccessful, the error handler is called with a geolocationError object as argument. This method takes as third argument geolocationOptions objects.
  • watchPosition(): Watches the change of latitude and longitude of the device. When the position of the device changes, this method calls its success handler with a Position object as argument and returns a watchID object. If the retrieval of geolocation information is unsuccessful or the device position has not changed during the specified timeout, the error handler is called with a geolocationError object as argument. This method takes as third argument geolocationOptions objects. To set the timeout, use geolocationOptions.
  • clearWatch(): Stops watching for changes in the device latitude and longitude. This method clears the geolocation.watchPosition that is referenced by watchID.

Back to Top

Screenshots

Platform Home Geolocation Data
All

Back to Top

Test the Sample

Apart from exploring the sample code base in GitHub, you can also clone and run the sample in your preferred AppBuilder client.

In-Browser

With the AppBuilder in-browser client, you can develop hybrid and NativeScript cross-platform mobile apps from your browser. You can use the in-browser client at https://platform.telerik.com.

Clone the sample

  1. Click Try in AppBuilder above.
  2. Provide your login credentials, if prompted.

Run the sample

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Deploy on device via QR code.

Back to Top

Windows

With the AppBuilder Windows client, you can develop hybrid and NativeScript cross-platform mobile apps from your Windows desktop. You can download and install the Windows client from http://www.telerik.com/appbuilder/windows-client.

Clone the sample

  1. Verify that the AppBuilder Windows client is running and you are logged in the Telerik Platform in the account in which you want to develop your application.
  2. In the dashboard, click Samples and select Hybrid.
  3. From the Workspace drop-down menu, select the workspace in which you want to develop your application.
  4. Select Core APIs.
  5. Select Geolocation.
  6. (Optional) Rename the project.
  7. Click Clone.

Run the sample

With the AppBuilder Windows client, you can quickly test your apps on device, in the simulator or in the native emulators.

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Run in the native emulators.
  4. Deploy on device via QR code.
  5. Deploy via cable connection.

Back to Top

Visual Studio

With the AppBuilder extension for Visual Studio, you can develop hybrid and NativeScript cross-platform mobile apps from Microsoft Visual Studio. You can download and install the extension from http://www.telerik.com/appbuilder/visual-studio-extension.

Clone the sample

  1. Verify that the AppBuilder extension for Visual Studio is running and you are logged in the Telerik Platform in the account in which you want to develop your application.
  2. Select AppBuilder โ†’ Get Sample.
  3. Select Hybrid.
  4. Select Core APIs.
  5. Select Geolocation.
  6. (Optional) Rename the project.
  7. Click Get.

The extension for Visual Studio copies the sample files locally. The extension creates a new solution and project and loads them.

Run the sample

With the AppBuilder extension for Visual Studio, you can quickly test your apps on device, in the simulator or in the native emulators.

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Run in the native emulators.
  4. Deploy on device via QR code.
  5. Deploy via cable connection.

Back to Top

CLI

With the AppBuilder command-line interface, you can develop hybrid and NativeScript cross-platform mobile apps from the command line. You can learn how to add the AppBuilder commands to your command line from http://www.telerik.com/appbuilder/command-line-interface.

Clone the sample

  1. Verify that a command prompt is running and you are logged in the Telerik Platform in the account in which you want to develop your application.

  2. To list the available samples, run the following command.

    appbuilder sample
  3. Run the clone command for the sample as listed by appbuilder sample.

    appbuilder sample clone geolocation

The AppBuilder command-line interface shows the following message: Successfully initialized project in the folder!

Run the sample

With the AppBuilder command-line interface, you can quickly test your apps on device, in the simulator or in the native emulators.

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Run in the native emulators.
  4. Deploy on device via QR code.
  5. Deploy via cable connection.

Back to Top

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.