Mobile Center

Mobile Center là hub quản lý tập trung bundle, ứng dụng Android/iOS và cấu hình layout cho VieLang Mobile.

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

TabMô tả
BundleNhóm cấu hình OAuth2, layout, self-registration
ApplicationsQuản lý từng app Android/iOS riêng lẻ
QR Code WidgetCà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

FieldMô tả
Bundle titleTên bundle (internal)
Android appClick "Create new" hoặc chọn app có sẵn
iOS appClick "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ển
    • Published — Đang chạy production
    • Deprecated — 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 TypeMô tả
DashboardTrỏ đến một dashboard cụ thể
WebviewMở URL trong webview
CustomTrang built-in của VieLang Mobile

Các route built-in có sẵn:

Tên trangRouteMô tả
Home/homeTrang chủ
Assets/assetsDanh sách tài sản
Device Profiles/devicesNhóm thiết bị
All Devices/deviceListTất cả thiết bị
Alarms/alarmsDanh sách cảnh báo
Dashboards/dashboardsTất cả dashboard
Dashboard cụ thể/dashboard/:idDashboard theo ID
Audit Logs/auditLogsNhật ký hoạt động
Customers/customersDanh sách khách hàng
Notifications/notificationsTrung 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:

  1. Mở bundle details
  2. Click Download configuration
  3. Lưu configs.json vào root project Flutter
  4. 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

  1. Mobile CenterApplications+ Add application
  2. Điền thông tin:
    • Package name
    • Platform: Android hoặc iOS
    • Application Secret
    • Status
    • Store information
  3. Click Add

Chỉnh sửa

  1. Mở app details
  2. Click icon bút chì màu cam
  3. Chỉnh sửa (không đổi được platform)
  4. 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

  1. Mobile CenterApplications → Chọn app Android
  2. Điền SHA-256 fingerprints:
    • Google Play: Play Console → Release → Setup → App Integrity → App Signing
    • Local APK: keytool -list -v -keystore your.keystore

iOS

  1. Mobile CenterApplications → Chọn app iOS
  2. Điền App Site Association ID: {Team ID}.{Bundle ID}

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}