title: Integrate GPS in JavafxPorts
body: <p>I have a Javafx application which is to be deployed in Android. My app needs to get the latitude and longitude but I dont know how to implement them. Can someone give me a code sample on how to do it in JavaFX?</p>
  
  <p><strong>UPDATED:</strong></p>
  
  <pre><code>package com.gpstracker;
  
  import javafx.application.Application;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.geometry.Insets;
  import javafx.geometry.Rectangle2D;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.TextField;
  import javafx.scene.layout.VBox;
  import javafx.stage.Screen;
  import javafx.stage.Stage;
  
  public class GPSTracker extends Application {
  
      @Override
      public void start(Stage stage) {
          TextField t1 = new TextField();
  
          TextField t2 = new TextField();
  
          Button button = new Button("Show Location");
          button.setOnAction(new EventHandler&lt;ActionEvent&gt;(){
              @Override
              public void handle(ActionEvent event) {
                  PositionService positionService = PlatformFactory.getPlatform().getPositionService();
                  Position position = positionService.getPosition();
              }
          });
  
          VBox root = new VBox(20);
          root.setPadding(new Insets(20));
          root.getChildren().addAll(t1, t2, button);
  
          Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
          Scene scene = new Scene(root, visualBounds.getWidth(), visualBounds.getHeight());
  
          stage.setScene(scene);
          stage.show();
      }
  
  }
  </code></pre>
  
  <p><strong>Gloun cant seem to find a class call PositionService and Position.</strong></p>