Web API

The RapidClipse framework provides several methods to use Web API functions of the end device e.g. to copy and paste a text into the user’s clipboard.

First, the Maven dependency must be added in the pom.xml:

<dependency>
    <groupId>com.rapidclipse</groupId>
    <artifactId>rap-server-webapi</artifactId>
    <version>12.0.0</version>
</dependency>

The API is built in several parts:

  • Clipboard - Copy and paste text to and from the system clipboard.

  • Device - General functions like vibrate or share links to other installed apps.

  • Geolocation - Read the geographic coordinates of the device.

  • Memory - Read the amount of available memory.

  • Network - Read information about the current network connection.

  • Notification - Local Notifications, which is displayed in the notification management of the device.

  • Online - Test when the device has an online connection again.

  • Payment - dialog with which information can be collected for payment with e.g. credit card.

  • Permission - Test whether the user has allowed certain Web API features or not.

  • Screen - General screen orientation and fullscreen functions.

  • Touch - Reading touch information.

  • Video - GUI element for playing multimedia as well as from the device’s cameras.

Many of the methods expect callbacks as parameters, since the javascript code cannot be executed until the information has been sent to the browser, which then sends the return values back to the server.

Important information:

  • Many of the features only work in a secure context (https connection to the server). However, these can still be tested e.g. with Google Chrome in the local network as follows:

    • To test features on localhost you can use Chrome under chrome://flags under Insecure origins treated as secure. http://localhost:8080 ** are entered

    • To try out features that only work on the cell phone, the local IP address of the PC can also be entered in the cell phone under Insecure origins treated as secure, e.g. http://192.168.0.123:8080

  • Many of these features must first be allowed by the user. When one of these features is executed, the user gets a small dialog window where he can allow or block this feature.

  • For some features like local notifications the application has to be marked as PWA! For this simply write @PWA over the main view

  • Not all of the features are currently supported by all browsers, to get browser compatibility information, websites like MDN can be used.