View on GitHub Sample viewer app

Opens and displays a scene from a mobile scene package (.mspk).

Image of open mobile scene package

Use case

A mobile scene package is an archive containing the data (specifically, basemaps and features), used to display an offline 3D scene.

How to use the sample

When the sample opens, it will automatically display the Scene in the mobile scene package.

Since this sample works with a local .mspk, you will need to download the file to your device.

How it works

  1. Create a MobileScenePackage using the path to the local .mspk file.
  2. Call MobileScenePackage.loadAsync and check for any errors.
  3. When the MobileScenePackage is loaded, obtain the first ArcGISScene using mobileScenePackage.getScenes().get(0)
  4. Create a SceneView and call sceneView.setView to display the scene from the package.

Relevant API

  • MobileScenePackage
  • SceneView

Tags

offline, scene

Sample Code

module-info.java module-info.java OpenMobileScenePackageSample.java
/*
* Copyright 2022 Esri.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module com.esri.samples.open_mobile_scene_package{
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
requires javafx.controls;
exports com.esri.samples.open_mobile_scene_package;
}