Open vanlooverenkoen opened 1 week ago
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:
@reboot /home/[your-username]/projects/launch_my_app.sh >> /home/[your-username]/projects/launch_my_app.log
*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? The service works great because you can say restart of fail so you get it out of the box.
@vanlooverenkoen as I know the cronjob not support it by default, but i found a convincing solution in stackexchange. I will check it later
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
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: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