ThingsBoard PE Mobile Application provides self-registration support. The mobile app with self-registration enabled provides a registration form allowing to sign up new customer users. It can be configured in Self Registration settings form by Tenant administrator user. See self-registration to understand general Self registration configuration. In order to enable self-registration in mobile app you should enable and configure it in the Mobile application self registration settings section of Self Registration settings form:
- As a Tenant administrator user Go to System Settings -> Self Registration;
- Check Enable self registration from mobile application checkbox;
- Specify you application package (For Android: your own unique Application ID. For iOS: Product bundle identifier.);
- Remember autogenerated Application secret or input your own secret;
- Specify Application URL scheme - can be any short string (for ex. myappscheme);
- Specify Application URL hostname - usually application id in reverse order (for ex. myapp.mydomain.org);
- Finally, to apply changes click Save button in bottom right corner of Self Registration form;
Additionally, you should modify your mobile app constants. Open flutter_thingsboard_pe_app project in your editor/IDE. Edit lib/constants/app_constants.dart.
Set value of thingsboardSignUpAppSecret constant to value of Application secret field:
1
2
3
4
5
6
abstract class ThingsboardAppConstants {
...
static final thingsboardSignUpAppSecret = 'Your sign up app secret here';
}
Finally, the following changes should be performed to enable activation link processing by mobile app:
-
For Android:
Edit android/app/src/main/AndroidManifest.xml, find and set scheme and host of browsable intent filter of the MainActivity. Set value of android:scheme to the value of Application URL scheme field, set value of android:host to the value of Application URL hostname field:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
... <activity android:name=".MainActivity" ... <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="value of Application URL scheme field" android:host="value of Application URL hostname field"/> </intent-filter> </activity> ...
-
For iOS:
Edit ios/Runner/Info-Debug.plist and ios/Runner/Info-Release.plist files, find CFBundleURLTypes array property. Set string value of CFBundleURLName property to the value of Application URL hostname field, set value of string array property CFBundleURLSchemes to the value of Application URL scheme field:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
... <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLName</key> <string>value of Application URL hostname field</string> <key>CFBundleURLSchemes</key> <array> <string>value of Application URL scheme field</string> </array> </dict> </array> ...
To verify your Self registration setup run the mobile app. You should see Create account link in the bottom of login form. After clicking on Create account link you should be directed to sign up form. If your setup is correct you should be able to perform sign up and activate account with mobile app when click on activation link from email within mobile phone.