Mobile Center
Mobile Center là giao diện quản lý tập trung cho toàn bộ ứng dụng mobile của VieLang IoT. Tất cả cấu hình bundle, OAuth2, navigation menu đều thực hiện tại đây.
Ba tab chính
| Tab | Mô tả |
|---|---|
| Bundle | Nhóm cấu hình OAuth2, layout, self-registration |
| Applications | Quản lý từng app Android/iOS riêng lẻ |
| QR Code Widget | Cài đặt widget QR code trên trang chủ |
Bundle
Bundle nhóm nhiều ứng dụng (Android + iOS) lại và chia sẻ chung cấu hình OAuth2, layout menu.
Tạo Bundle mới
Vào Mobile Center → tab Bundle → + Add bundle:
1. Basic Settings
| Field | Mô tả |
|---|---|
| Bundle title | Tên bundle (internal) |
| Android app | Click "Create new" hoặc chọn app có sẵn |
| iOS app | Click "Create new" hoặc chọn app có sẵn |
Tạo app mới trong bundle:
- Package name:
com.company.appname(Android) / Bundle ID (iOS) - Application Secret: Auto-generate hoặc đặt tay (dùng trong
configs.json) - Status:
Draft— Đang phát triểnPublished— Đang chạy productionDeprecated— Không còn hỗ trợSuspended— Tạm dừng
- Min/Max version: Kiểm soát phiên bản nào được đăng nhập
- Release notes: Ghi chú phiên bản
- Store link: Google Play / App Store URL
- SHA256 fingerprint (Android) / App ID (iOS): Dùng cho QR code deep link
2. OAuth 2.0
Cấu hình đăng nhập qua bên thứ ba (Google, Facebook, LDAP):
- Chọn OAuth2 client đã tạo trong Settings → OAuth2
- Hoặc bỏ chọn để disable OAuth2 trên mobile
3. Layout (Navigation Menu)
Tùy chỉnh menu bottom bar của app:
Click + Add specific page để thêm menu item:
| Page Type | Mô tả |
|---|---|
| Dashboard | Trỏ đến một dashboard cụ thể |
| Webview | Mở URL trong webview |
| Custom | Trang built-in của VieLang Mobile |
Các route built-in có sẵn:
| Tên trang | Route | Mô tả |
|---|---|---|
| Home | /home | Trang chủ |
| Assets | /assets | Danh sách tài sản |
| Device Profiles | /devices | Nhóm thiết bị |
| All Devices | /deviceList | Tất cả thiết bị |
| Alarms | /alarms | Danh sách cảnh báo |
| Dashboards | /dashboards | Tất cả dashboard |
| Dashboard cụ thể | /dashboard/:id | Dashboard theo ID |
| Audit Logs | /auditLogs | Nhật ký hoạt động |
| Customers | /customers | Danh sách khách hàng |
| Notifications | /notifications | Trung tâm thông báo |
Lưu ý: Menu items thừa (không fit bottom bar) sẽ gộp vào trang "Thêm".
4. Tải Configuration File
Sau khi lưu bundle:
- Mở bundle details
- Click Download configuration
- Lưu
configs.jsonvào root project Flutter - Rebuild app:
flutter run --dart-define-from-file configs.json
Applications
Tab Applications quản lý từng app Android/iOS độc lập (không qua bundle).
Thêm Application
- Mobile Center → Applications → + Add application
- Điền thông tin:
- Package name
- Platform: Android hoặc iOS
- Application Secret
- Status
- Store information
- Click Add
Chỉnh sửa
- Mở app details
- Click icon bút chì màu cam
- Chỉnh sửa (không đổi được platform)
- Save
Xóa
Click icon thùng rác → xác nhận.
QR Code Widget
Cấu hình widget QR code để người dùng quét mã tải app:
Android
- Mobile Center → Applications → Chọn app Android
- Điền SHA-256 fingerprints:
- Google Play: Play Console → Release → Setup → App Integrity → App Signing
- Local APK:
keytool -list -v -keystore your.keystore
iOS
- Mobile Center → Applications → Chọn app iOS
- Điền App Site Association ID:
{Team ID}.{Bundle ID}- Team ID: Apple Developer Account
REST API
# Lấy danh sách bundles
GET /api/mobile/bundle?pageSize=10&page=0
Authorization: Bearer {JWT}
# Tạo bundle mới
POST /api/mobile/bundle
Authorization: Bearer {JWT}
Content-Type: application/json
# Lấy config file (dùng cho Flutter --dart-define-from-file)
GET /api/mobile/bundle/{bundleId}/config
Authorization: Bearer {JWT}