课程: FileMaker: Tips, Tricks, and Techniques
Sensor support in FileMaker Go - FileMaker Pro教程
课程: FileMaker: Tips, Tricks, and Techniques
Sensor support in FileMaker Go
- [ Instructor] There are sensors on iPhones and iPads and sometimes even laptops that some custom app writers might want to access. FileMaker Pro 17 Advanced now includes a single GetSensor function that provides an easy concise way for users to access these functions. For example, perhaps a custom app writer wants the ability to monitor the current heading in a boat and ship tracking app, or the barometric pressure or even the elevation above sea level. To fully understand the capabilities, you must understand all the parameters and potential sensors that FileMaker can read. The GetSensor function, really has one parameter and two optional parameters. The parameter is the sensor name of which I'll show you some examples in just a moment. And some of those sensor names have options up to two different options per parameter. For example, we might say GetSensor, calling out the StepCount parameter and putting the number 3600 that represents the number of seconds. So for example, that would return 8000, if the user has taken 8000 steps in the past hour. That's what the 3600 seconds represents. Let's take a look at the sensors that FileMaker can read. Battery level and status, location, altitude, acceleration and speed, magnetic fields or compass headings, step data, air pressure. Then we can even use the GetSensor using the available function to tell us which sensors are available on the device that's running your app. Let's take a look at a couple of these features in action. In this example, we have a custom app that was created to track dog walks. We're going to use several GetSensor parameters to gather the various data points. The custom app creates a record each time a user goes on a walk and allows the user to select the walker then a dog. And then the user selects the start walk button and the custom app grabs their starting latitude and longitude and then they do their walk. Upon completion of the walk, the user selects and walk, and FileMaker Go grabs various data points from the devices sensor. These values are used in a card that are displayed at the end of the workflow. The app even uses the latitude and longitude gathered to send to the map app on the device to plot the walk. Nearly all of the functionality in this custom app is made possible by the ability of FileMaker Go to access sensor functions on the device. Let's take a look at the script to see the different ways that GetSensor was used. So first, we use the GetSensor with the battery level parameter to check to see whether the user's device has more than 50% battery. Since the GetSensor function will return a value between 0.0 and 1.0 to represent a range between 0 and 100% charge. Next we're going to grab the starting location. And in this case, we're using the GetSensor in two different ways. Since the GetSensor function returns a return delimited list or an array of values where the first value in the rays the latitude, and the second value in the array is longitude. We're going to take the first value, concatenate it together with a comma in between, and then grab the second value giveness latitude comma longitude. We use that to plot the location on the map later. Now the app waits for the user to interact with the end walk button, which runs the end current walk script. The end current walk script is triggered when the user clicks the end walk button and confirms that they want to end the walk. And then the location parameter is used to gather the ending latitude and longitude. Next, the StepCount parameter is used to grab the steps that we use and the option one for per seconds parameter is used to gather the number of seconds during the duration. That in our case is determined by the difference between the ending timestamp and the starting timestamp which happens to give us a number in seconds. And finally, we use the step distance parameter, and the same seconds duration along with a custom function that converts meters into miles, because by default, we'll get a value in meters. FileMaker Pro 17 advanced now provides us an easy, concise way for users to access all of these sensor functions. And all of them can be learned by understanding just one single calculation function.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Sensor support in FileMaker Go4 分钟 26 秒
-
(已锁定)
Enhanced signature capture3 分钟 8 秒
-
(已锁定)
Animations and transitions in FileMaker Go2 分钟 40 秒
-
(已锁定)
Touch ID support5 分钟 27 秒
-
(已锁定)
Core ML support6 分钟 38 秒
-
(已锁定)
Working with Core ML, part 13 分钟 43 秒
-
(已锁定)
Working with Core ML, part 23 分钟 42 秒
-
(已锁定)
Working with Core ML, part 31 分钟 53 秒
-
(已锁定)
Working with Siri shortcuts4 分钟 35 秒
-
(已锁定)
Setting advanced Siri shortcuts using FileMaker scripts4 分钟 27 秒
-
(已锁定)
NFC support7 分钟 24 秒
-
(已锁定)
Setting up your NFC tag2 分钟 13 秒
-
(已锁定)
Working with NFC in your FileMaker app3 分钟 2 秒
-
-
-