-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to launch your flutterpi app at startup #461
Comments
Currently I use cron job to run program on boot, all functionalities (also touch and keyboard) are working like a charm sudo crontab -e then in the bottom of the text editor (you can use vim, nano, etc) add this line:
*note: change [your-username] with your actual username Then save the cron settings |
@effmuhammad cool! I have a functionality "restart app" or "restart on crash" how would you do that with a cronjob? |
@vanlooverenkoen as I know the cronjob not support it by default, but i found a convincing solution in stackexchange. I will check it later |
The approach I've found to work (so far) it to override the command run by the standard getty on the first tty:
This stops the standard login getty process claiming tty1. Note: the empty ExecStart= line is required, otherwise you add a command rather than replacing the getty. It's early days in testing, but this is the approach I'm using for my Boat Instrument. As a quick test, you could install the Boat Instrument from my Debian PPA and test if your touchscreen and keyboard work. |
What is the best way to launch your app at startup and have keyboard support & touch support (basicly everything)
This is what I followed. And it works. but this keeps a terminal open where the keyboard types
Launch script
Create a script here
~/projects/launch_my_app.sh
#!/bin/bash flutter-pi --release projects/my_app
Boot service
Here's a comprehensive setup guide for creating a systemd service that will automatically launch your Flutter app on a Raspberry Pi using your custom startup script.
1. Create the Systemd Service File
Open a terminal on your Raspberry Pi and create a new service file for your app:
2. Configure the Service File
In the editor, paste the following configuration. Adjust the paths and usernames as necessary.
launch_my_app.sh
).pi
with your actual username.:0
if your setup uses a different display.3. Enable the Service to Start on Boot
After configuring the service file, save and close the editor (
Ctrl+X
, thenY
, thenEnter
). Then, enable the service to run on boot:sudo systemctl enable my_app.service
4. Test the Service
To test that everything is set up correctly, start the service manually:
You can check the status to verify that it’s running without errors:
5. Reboot to Confirm Auto-Start
To ensure the service starts on boot, reboot your Raspberry Pi:
Once the system reboots, you can confirm that your app is running by checking the service status again:
This setup ensures your Flutter app will start automatically each time the Raspberry Pi reboots, using your
launch_my_app.sh
script for custom setup.6. Stop the service
The problem
This works, only the keyboard is still typing in the terminal that is still open behind the flutter app
The text was updated successfully, but these errors were encountered: