Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GluonFX plugin to Maps sample #59

Merged
merged 3 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
abhinayagarwal marked this conversation as resolved.
Show resolved Hide resolved
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);
}
}