thingsboard / flutter_thingsboard_app

ThingsBoard Mobile Application
https://thingsboard.io/products/mobile/
BSD 3-Clause "New" or "Revised" License
223 stars 165 forks source link

solution for flutter build of thingsboard mobile app and notification(FCM) problem #106

Closed philiaa closed 1 month ago

philiaa commented 2 months ago

hi everyone... i always thnaks for thingsboard team....^^.... thngsboard is great platform and good for iot....

when build thingsboard mobile app on flutter....got some issues... because each local envionment i also tried solve for some issues...i got several solutions.... so I would like to share several solutions with everyone

my server spec : ubuntu20.06 lts thingsboard version : 3.70(no problems for installl and use, just followed install step in install document) thingsboard install option : postgresql, queue(in memory)

network settings : server(thingsboard)->router(Port forwarding and DDNS service)->http://xxxx.xxxx.com:8080(just for test)

flutter development environment : android sdk API 35(installed on android studio). flutter sdk 3.19.6(very important) image

thingsboard mobile app verion : 1.1.0 and 1.2.0 ..tested

  1. don't change pubspec.yaml ( most of user changed pubspec.yaml, because warning message) Screenshot from 2024-08-09 12-21-13

FIRST RED WARNING : grdle plug in warning --> modify some gradle file, but you can ignore that's waring_ if you want remove thats waring --->https://stackoverflow.com/questions/78032396/applying-flutters-app-plugin-loader-gradle-plugin-imperatively-using-the-apply-s

  1. SECOND RED WARNING : -Xlint:deporecation issues --> need three step command flutter pub cache repair flutter pub cache clean flutter pub get and then flutter run or flutter build apk --release --target-platform=android-arm64 (for test on your device)

  2. push notification via FCM( did not solved) **if you need firebase, you do it this step firstly***

i followd all step in https://thingsboard.io/docs/mobile/getting-started/

Step 3. Configure ThingsBoard API endpoint( most of user mistyped addresss , my sever addresss : http://xxxx.xxxx.com:8080(DDNS address)

Step 4.1 Create Firebase project( you can setting on firebase site....very ease) Step 4.2 Add Firebase to your mobile application --> firebase Cli install--> https://firebase.google.com/docs/cli#setup_update_cli

--> firebase log in --> your prompt(linux or windows) $ firebase login

--> flutterfire_cli activate --> your prompt(linux or windows) $ dart pub global activate flutterfire_cli

and then firebase configuration for your app

flutter_thingsboard_app(your thingsboard mobile app project folder) $ flutterfire configure

you can choice two step( first is your firbase project name and then firbase for android or ios)

KakaoTalk_20240809_132445744_03 KakaoTalk_20240809_132445744_02 KakaoTalk_20240809_132445744_01

ALL IS OK BUT.......push notification problem send message to app from firebase console (work well) KakaoTalk_20240809_132445744

but when i send mobile message on thingsboard notification center ..... "User doesn't use the mobile app" error. so i tried check all source and db....but i cant solve that KakaoTalk_20240809_132445744_05 touch Notifications KakaoTalk_20240809_132445744_04 Notifications are not configured. Please contact your system administrator error

thingsboard cloud app is not happend that's error.(customer login and then touch notification, show notification informaton well)... so i think thats issues on thingsboard ce version.... thanks for all and thanks for thingsboard team

C3sarz commented 1 month ago

Thank you for your contribution, I was also having difficulties compiling the app with the newest flutter SDK. By downgrading flutter to 3.19.6 the app finally did compile.

ybeshkarov commented 1 month ago

Hello @philiaa,

Thank you for your contribution and for helping to improve the ThingsBoard app.

Could you let me know if you configured Firebase for the mobile app locally? Also, have you noticed any changes in the lib/firebase_options.dart file?

philiaa commented 1 month ago

hello @ybeshkarov

i just configured private key of Firebase on local server(settings->notification->mobile settings).... don't have any changed in the lib/firebase_options.dart file....Same as the original file(flutter_thingsboard_app github source)

ybeshkarov commented 1 month ago

You'll also need to complete steps 4.2 - 4.3 from the Getting Started guide.

@philiaa

philiaa commented 1 month ago

@ybeshkarov thank you for your reply yes of course....i did complete steps 4.2 - 4.3 from the Getting Started guide. for android without ios

  1. $ firebase login
  2. $ dart pub global activate flutterfire_cli
  3. project folder$ flutterfire configure and then created firebase_options.dart file (but same as original file from flutter_thingsboard_app source) check contain -> android/app/google-services.json

if i didn't this step.....i think that i can't push alram message from firebase console directly.....

ybeshkarov commented 1 month ago

That's odd. After running flutterfire configure, the firebase_options.dart file should have been updated.

Did you select 'yes' when flutterfire configure prompted you to replace the file?

philiaa commented 1 month ago

@ybeshkarov i solved that.....thank you for your advice and reply... i deleted firebase_options.dart file and then running flutterfire configure again.... i received push notification on android app from notification center on thingsboard server thank you thingsboard team...^^