How can i use Mobile Hardware components, like: MNotification, MCamera, MGeolocation, MAccelerometer?

StackOverflow https://stackoverflow.com/questions/16473809

  •  21-04-2022
  •  | 
  •  

Frage

I am using Embarcadero's HTML5Builder for Android server mobile apps development.

How can i use Mobile Hardware components, like: MNotification, MCamera, MGeolocation, MAccelerometer ?

War es hilfreich?

Lösung

Well, you mainly configure their properties at design time, and use JavaScript events (MPage’s or otherwise) to work with your hardware components. To get you started with client events, I recommend you to follow the Hello World tutorial for client mobile applications, but using a server mobile application instead.

Obviously, each mobile hardware component works differently. What is common about them is how to find out how to use them.

In the documentation there is a page, Mobile Hardware Components, with a list of hardware components. Most hardware components have a page of its own linked there.

Note: Links to the RPCL Reference in the documentation (RPCL is the HTML5 Builder PHP library) are broken. To access the reference documentation for a hardware component, create a mobile application, add the target hardware component to it, select the component and click F1.

Most hardware component pages in the wiki provide a section, Help Resources, with tutorials, video tutorials, links or references to sample applications, or links to the PhoneGap documentation (hardware components are based on PhoneGap).

In addition to properties and JavaScript events, sometimes you use JavaScript functions to interact with components. Those JavaScript functions are not listed in the (PHP) RPCL Reference, but they are listed in the wiki pages.

So, about the components that you mention:

  • To use MNotification, you just need to define the Message property at design time, and call ComponentNameNotification() (for example, MNotification1Notification()) from a JavaScript event, such as MPage’s OnLoad, or from a Button’s OnClick.

  • To use MCamera, you call ComponentNameGetPicture(), and define event handlers for OnError and OnSuccess.

  • For MGeolocation I recommend watching the video tutorial linked from the documentation.

  • In the case of MAccelerometer, the sample application references on the documentation might be a good start point.

Note: You mention you will work on server mobile applications, so I think it’s worth mentioning that, while mobile hardware components do work on server applications, they only work when you deploy them with the Mobile Deployment wizard, as they are based on PhoneGap.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top