This project is still a work in progress 🚧. Issues and pull requests are highly appreciated
Do you have an app developed using MATLAB App Designer that you want to distribute but wish to control who can use it?
In simple words, you wish to grant app licenses to specific users.
- This system is dependent on GitHub. You will need to have a GitHub account and a private repository dedicated for your app.
- By integrating this licensing system, your app will need to be connected to the Internet every time the user starts it (during the startup only).
- Create a GitHub account if you don't have one yet.
- Create a private repository. If you already have a repository that you use as the codebase of the app development, you can use that instead. This repository will be referred to as
app-development
. - Add
matlab-app-licensing
repository as a submodule ofapp-development
(read more). - Run
LicenseManager.mlapp
and follow the instructions in the app (note: you must have MATLAB installed).
-
In your app's
mlapp
file, add the following code block at the very beginning of theStartupFcn(app)
function:addpath(genpath('matlab-app-licensing')); IsCloseSelected = checkDeviceRegistration(app, 'my-username', 'my-repo-name', 'my-personal-access-token'); if IsCloseSelected delete(app); return; end
Replace
my-username
,my-repo-name
andmy-personal-access-token
with your username, theapp-development
repository's name and your Personal Access Token (PAT, see no. 2), respectively. -
Refer here for the guide to generate a PAT. Only
repo
needs to be selected. Set the PAT to never expires.
-
In the App Designer, add a Button or Menu, name/label it as License Info or something similar.
-
Add the following code block at the very beginning of the Button/Menu's callback function:
AppDeactivation(app, 'my-username', 'my-repo-name', 'my-personal-access-token');
The same PAT can be used.