priobike / priobike-flutter-app

A smartphone app for cyclists in Hamburg that provides bike navigation and speed advisories for traffic lights
MIT License
6 stars 0 forks source link

PrioBike-HH Flutter App

The PrioBike app gives speed advisories to cyclists in Hamburg to catch green lights. It is developed by TU Dresden and currently in open beta.

Download

The PrioBike app is available for download:

Quickstart

Required Flutter Version: 3.19.6

For getting started with development you need to set up your development environment according to the guide.

Setting up for iOS development

Make sure to cp .netrc.example ~/.netrc and replace <your mapbox download token> in ~/.netrc with your MapBox secret.

Setting up for Android development

Make sure to cp android/gradle.properties.example android/gradle.properties and replace <your mapbox download token> in android/gradle.properties with your MapBox secret.

Also make sure to cp android/key.properties.example android/key.properties and cp android/fastlane/example-keystore.jks android/fastlane/keystore.jks to be able to sign the app for local release builds. This is different from our Google Play upload keystore and therefore not confidential.

Generating App Icons and Splash Screen

This project uses flutter_launcher_icons to generate app icons. To generate them, replace assets/icon.png and then run: flutter pub run flutter_launcher_icons:main.

To provide a splash screen, this project uses flutter_native_splash. To generate the splash screens for Android and iOS, replace assets/splash.png and then run: flutter pub run flutter_native_splash:create.

Note: Android 12 Splash Screen Support

Since Android 12 implements its own splash screen, a solution must be found for this version, since otherwise there will be two different splash screens. It was decided to keep the Android 12 splash screen (since this one can't be deactivated) and replace the second unwanted splash screen with a uniform color. For this purpose, a separate launch_background drawable file was created for Android v31. More information can be found here.

+ android/app/src/main/res/drawable-night-v31/launch_background;
+ android/app/src/main/res/drawable-v31/launch_background;

Continuous Delivery

Flutter App Development

On push to dev or beta, a build workflow will be triggered to distribute our app.

Clean up Android logs

Since we use the textureView for our Mapbox Maps, the log gets spammed with the following message:

updateAcquireFence: Did not find frame.

According to this, this is meaningless for us. Therefore we can use filters in our IDE to exclude this message from the log (ensuring a clean log).

For Android Studio include the following filter when using Logcat:

package=:de.tudresden.priobike -message:"updateAcquireFence: Did not find frame."

For Visual Studio Code it is not that important because it groups the messages already such that they are not that annoying. To exclude those use the following filter:

!updateAcquireFence: Did not find frame.

Documentation for Flutter

For help getting started with Flutter, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Troubleshooting

IOS-Simulator doesn't work on M1-Macs

Currently (Nov. 2022) XCode still has legacy applications that don't fully work on Apple's M1-Chips. One such application is the iOS-Simulator. There are several options to fix this.

The easiest fix is to change PrioBike/priobike-flutter-app/ios/Pods/Pods.xcodeproj/project.pbxproj:

- VALID_ARCHS[sdk=iphonesimulator*] = "$(ARCHS_STANDARD)";
+ VALID_ARCHS[sdk=iphonesimulator*] = x86_64;

Also, if there is a problem with the iPhoneOS-Deployment-Target, change it to 11.0 in the same file:

- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
- IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;