XDEV Mobile Kit
The XDEV Mobile Kit allows you to access mobile devices from a server application developed with RapidClipse as well as the final deployment of hybrid apps.
- Tools - Allow you to deploy hybrid mobile apps and transfer them directly to mobile devices.
- API - Grants access to hardware and system functions of mobile devices via Vaadin.
Supported services
Device buttons - App service
/** * Add a button handler, e.g. for the back button */ AppService.getInstance().addBackButtonHandler(event->{ // Do something ... // and consume event so that it will not be processed in the default manner by the source which originated it. event.consume(); });
Barcode scanner - Access to all barcode scanners. Some of the formats: QR, Data Matrix, UPC E/A, EAN 8/13, Code 128/93/39, CodeBar, ITF, RSS 14/Expanded, PDF417, MSI, Aztec
/** * Use BarcodescannerService to scan a barcode. * Results are delivered asynchronously via callbacks. */ /** * Opens the barcode scanner app. */ void scan() { BarcodescannerService.getInstance().scan(this::barcodeScanned,this::onError); } /** * Success callback */ void barcodeScanned(final BarcodeData barcode) { System.out.println(barcode.getFormat()+": "+barcode.getData()); } /** * Error callback */ void onError(final MobileServiceError error) { System.err.println(error.getMessage()); }
- Camera
- Access to photo and video function, front and back camera
- Direct transfer of images and videos
- Storage of pictures and videos on the device with later processing via file service. Optional: Picture/video, front/back camera, quality, file format
- Access to image library
/** * Use CameraService to take pictures, videos or to choose a file from an album. * Results are delivered asynchronously via callbacks. */ /** * Opens the camera app. */ void takePicture() { final CameraOptions options = CameraOptions.takeAndReturnPicture(); CameraService.getInstance().getPicture(options,this::pictureTaken,this::onError); } /** * Success callback */ void pictureTaken(final ImageData imageData) { // do something with taken picture } /** * Error callback */ void onError(final MobileServiceError error) { System.err.println(error.getMessage()); }
- Contacts
- Browse the contact database
- Select a contact
- Edit and save a contact
/** * Use ContactsService to work with contacts. * Results are delivered asynchronously via callbacks. */ /** * Shows the contact picker app */ void pickContact() { ContactsService.getInstance().pickContact(this::contactPicked,this::onError); } /** * Finds contacts by name */ void findContacts(String name) { final ContactFindOptions options = ContactFindOptions.byName(name); ContactsService.getInstance().find(options,this::contactsFound,this::onError); } /** * Success callback */ void contactPicked(final Contact contact) { System.out.println(contact); } /** * Success callback */ void contactsFound(final List<Contact> contacts) { System.out.println(contacts); } /** * Error callback */ void onError(final MobileServiceError error) { System.err.println(error.getMessage()); }
File system - Reading access to the file system of the mobile device.
- Geolocation
- Current position (lines of longitude and latitude as well as altitude)
Tracking the position by motion data (direction and speed)
/** * Use GeolocationService to acquire position information. * Results are delivered asynchronously via callbacks. */ /** * Lookup the current position of the device */ void getCurrentPosition() { GeolocationService.getInstance().getCurrentPosition(this::positionFound,this::onError); } /** * Success callback */ void positionFound(final Position position) { System.out.println(position); } /** * Error callback */ void onError(final MobileServiceError error) { System.err.println(error.getMessage()); }
NFC - Option to read and write NFC tags
/** * Use NfcService to read and write NFC tags. * Results are delivered asynchronously via callbacks. */ /** * Start listener */ void startListening() { NfcService.getInstance().startNdefListener(this::ndefListenerCallback,this::startNdefListenerSuccess,this::onError); } /** * Stop listener */ void stopListening() { NfcService.getInstance().stopNdefListener(this::stopNdefListenerSuccess,this::onError); } /** * Tag read callback */ void ndefListenerCallback(final Ndef ndef) { final Tag tag = ndef.getTag(); System.out.println(tag); } /** * Listener successfully registered */ void startNdefListenerSuccess(final String message) { System.out.println(message); } /** * Listener successfully removed */ void stopNdefListenerSuccess(final String message) { System.out.println(message); } /** * Error callback */ void onError(final MobileServiceError error) { System.err.println(error.getMessage()); }
- Vibration
- Simple vibration with variable duration, e.g. 1 sec.
- Vibration patterns with variable duration and pauses, e.g. Vibration 0.5 sec, Pause 0.3 sec, Vibration 0.1 sec., etc.
/** * Vibrates one second */ VibrateService.getInstance().vibrate(1000); /** * Pattern: Vibrate 500 ms, pause 250 ms, vibrate 250 ms (Android only) */ VibrateService.getInstance().vibrate(500,250,250);
Deploy mobile app
XDEV Software Corp. - One Embarcadero Center, San Francisco, CA 94111, US
Copyright © 2015. XDEV Software Corp. All rights reserved.