viewer-android-studio-sample
Sample on Workflow of Forge Viewer by Android Studio
- NOTE:
- 1. This sample was programmed on Eclipse + ADT. Now it is migrated to Android Studio
- Please get the old commit if you still need the version of Eclipse + ADT.
- 2. Demo APK is not provided as it would ask the user to store customer's model in the author's bucket of Forge
- which does not apply to the compliance of data protection. So,please build the sample with your own
- credential and produce the APK
Description
This is a sample for Android devices demoing how to translate 2D/3D file by Forge platform, and view them in the browser of mobile.
Setup
Usage
- Open the App on android device or emulator, click [Get Token] >> token should appear in the text box.
- Input bucket name in text near box under [create bucket], click [Create Bucket] >> wait for the success info. The bucket key (i.e. bucket name) must match “^[-.a-z0-9]{3,128}$”. That is bucket must be between 3 to 128 characters long and contain only lower-case letters, numbers and the symbols . –. And bucket keys must be unique within the data center or region in which they were created. Best practice is to incorporate your company name/domain name or the client Id into the bucket name. If you prefer to use the client Id(should convert to lower-case first) as part of bucket name, please note that it is the consumer key, not the secret key. Please also pay attention to the length of the whole bucket name, which should be less than 128.
- Click [Browser Model] to show available test file list, choose one of them
- Click [Upload Model] to upload the model file, the URN appears in the text box once file is uploaded.
- Click [Post Job] to send a job to translate the model, status shows up in text box.
- Once the translation status is completed, click [Show thumbnail] to get the thumbnail and display it in the image box blow. You may see "get thumbnail failed" if translation is still not in progress, you can try again latter.
- Click [Launch Viewer] to launch the viewer in a WebGL enabled browser. The code taks advantage of a demo website by inputing the token and urn, then the demo website will launch the viewer. the workflow could be repalced with any other demo website or your own website if it follows the format that inputs token and urn. It is tested on the default browser of the device. If you have problems with this step, you can look into console of browser with USB debugging.
License
This sample is licensed under the terms of the MIT License.
Please see the LICENSE file for full details.
Written by
Xiaodong Liang
Developer Advocate
Autodesk Forge Partner Development