Saturday, August 3, 2013

Capturing a Device's Persistent ID at Login

If you're developing a commercial FileMaker product you'll want to think about how to set limits on the number of permitted devices (iOS for mobile) that may access your solution. Part of solving this problem also touches on the issues of software piracy and registration.

The example file below revolves around the use of FileMaker 12's native function Get(PersistentId) to log and record each device (computer and mobile devices such as an iPhone or iPad) which may access the file. According to FileMaker Inc. the description of the Get(PersistentId) function is:

"Returns a unique, unchanging identifier for the computer on which FileMaker Pro is running or the device on which FileMaker Go is running, in the form of a 32-digit hexadecimal string." 

The example FileMaker file contains 2 tables, Registration (REG__Registration) and Device (DVC__Device). There is a one-to-many relationship between the Registration table and the Device table.

A Test Persistent ID button exists on the main layout (REG__Registration_detail) that simulates login to the file. Each time this button is clicked the logic is tested to determine:

  1. whether there's a record for the device's Persistent ID that's accessing the file AND
  2. if the device's Persistent ID has not been added in the Device table, has the solution met it's device storage limit?
If you're testing out the example file from your computer, you'll always get/return the same Persistent Id, so I've included a Change PersistentID button which is displayed in each portal record. Clicking the Change PersistentID button changes the persistent Id and will allow you to continue clicking the Test Persistent ID button and adding new records to the Device table until the limit is reached.

Of course, as a developer you'll deny users any access to the Registration and Device tables. You'll also have to think about how to update the device records if a user (perhaps someone that is a legitimate user) accesses the file with a new device. One hint would be at storing the Persistent IDs in a remote MySQL table and using calls, via PHP script from the FileMaker file to the MySQL table to record information about each device, but this is beyond the scope of this blog entry.

File: Device_Registration.fmp12.zip

UPDATE: 9-16-2013

This file may not work properly with iOS 7 as there is a bug with the Get(PersistentId) function: http://bit.ly/16dkdCX

No comments:

Post a Comment