Using native device features (PhoneGap)

Apache Cordova (PhoneGap)

When you create a new app in Tiggzi (Mobile app type, learn how to change type), the app includes Apache Cordova (PhoneGap) library. This means you can right away use any of the JavaScript API provided by PhoneGap. For example, if you want the device to beep, you can add this code and run it on button click:

navigator.notification.beep(2);

As this is a native API call, you need to install the app on the device to test it. You can also use the Tiggzi Mobile Tester to test the app. Learn more about testing.

To check the current PhoneGap version included in Tiggzi builder, go to Project > App Settings > External resources.

Adding native components

While you can use any PhoneGap JavaScript API, Tiggzi comes with a number of APIs available as pre-configured native services (components). The following services are available:

  • Camera
  • Barcode scanner
  • Geolocation
  • Contacts

To add a native component to an app, Project > Create new > Services, then select one of the native components and click Create Service:

Once the service has been added, it will be listed under Services folder:

Note that if you already added one of the native components to an app, that selection will be disabled. This means you can have version of the native service in your app but you can still add the service to any number of pages.

If you open the service, you will notice that the service has the same structure as a regular REST service. The service has Request and Response but the values in them are pre-defined (using the Camera service):

Request:

Response:

Once a native service has been added to the app, it can be added to one or more pages. Adding a native service to a page is very similar to adding a REST service to a page:

  1. Open Data view
  2. For datasource, select Device > CameraService > Click Add:

Once the service has been added to the page, click Edit Mapping to map the service to the page. Learn more about mapping.

Camera

Tutorial: Using Camera component

Geolocation

Tutorial: Building a mobile app with Google Map and Geolocation