Skip to content

Commit

Permalink
Add GluonFX plugin to Maps sample (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinayagarwal authored Jul 22, 2021
1 parent 478df35 commit a8bb9ba
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 16 deletions.
51 changes: 47 additions & 4 deletions samples/mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,55 @@

This sample demonstrates how to use Gluon Maps inside a JavaFX application.


## Instructions

To execute this sample, using Java 11, do as follows:
We use [GluonFX plugin](https://docs.gluonhq.com/) to build a native image for platforms including desktop, android, iOS and embedded.
Please follow the GluonFX prerequisites as stated [here](https://docs.gluonhq.com/#_requirements).

### Desktop

Run the application using:

./gradlew run

Build a native image using:

./gradlew nativeBuild

Run the native image app:

./gradlew nativeRun

### Android

Build a native image for Android using:

./gradlew nativeBuild -Ptarget=android

Package the native image as an 'apk' file:

./gradlew nativePackage -Ptarget=android

Install it on a connected android device:

./gradlew nativeInstall -Ptarget=android

Run the installed app on a connected android device:

./gradlew nativeRun -Ptarget=android

### iOS

Build a native image for iOS using:

./gradlew nativeBuild -Ptarget=ios

Install and run the native image on a connected iOS device:

./gradlew nativeRun -Ptarget=ios

Create an IPA file (for submission to TestFlight or App Store):

* Desktop
> `./gradlew run`
./gradlew nativePackage -Ptarget=ios


19 changes: 14 additions & 5 deletions samples/mobile/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Gluon
* Copyright (c) 2018, 2021, Gluon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -28,14 +28,23 @@

plugins {
id 'application'
id 'com.gluonhq.gluonfx-gradle-plugin' version '1.0.3'
}

dependencies {
implementation project(':maps')
implementation "com.gluonhq.attach:storage:$attachVersion:desktop"
implementation "com.gluonhq.attach:position:$attachVersion"
implementation "com.gluonhq.attach:lifecycle:$attachVersion"
implementation "com.gluonhq.attach:util:$attachVersion"
}

gluonfx {
target = 'host'
if (project.hasProperty('target')) {
target = project.getProperty('target')
}
attachConfig {
version = "$attachVersion"
services "lifecycle", "position", "storage"
}
resourcesList = [ "logging.properties" ]
}

mainClassName = "$moduleName/com.gluonhq.maps.samples.mobile.MobileSample"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Gluon
* Copyright (c) 2018, 2021, Gluon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -39,6 +39,10 @@
import javafx.geometry.Pos;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Screen;
import javafx.stage.Stage;

Expand All @@ -47,11 +51,6 @@
import java.util.logging.LogManager;
import java.util.logging.Logger;

import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;

public class MobileSample extends Application {

private static final Logger LOGGER = Logger.getLogger(MobileSample.class.getName());
Expand Down Expand Up @@ -123,4 +122,8 @@ private MapLayer positionLayer() {
return answer;
});
}
}

public static void main(String[] args) {
Application.launch(args);
}
}

0 comments on commit a8bb9ba

Please sign in to comment.