Update to Capacitor 5, fix push messages on Android13+
do a hackathon together with @jakob and @sebquack to work on this
-
try updating to Capacitor5, use updated Pushnotifications plugin - update interkit package package.json 2.4.7→5.6.0
- update android studio >=2022
- update project package.json 2.4.7→5.6.0, add plugins
upgrade existing project to new capacitor- re-init project:
rm -rf android; npx cap add android; npx cap sync android
- fix CLEARTEXT error
- re-add
android/app/google-services.json
(from starter) - update
PushNotifications.requestPermissions()
- disable
InterkitLiveReload
-
test on real Android13+ device -
test targetSdk 33
looks like Capacitor5 comes with currentvariables.gradle
:
minSdkVersion = 22, compileSdkVersion = 33, targetSdkVersion = 33
-
fix isPushNotificationsAvailable
-
check new(?) plugin API: https://capacitorjs.com/docs/apis/push-notifications, like icon, style
added some handwavey docs -
in Capacitor5, SplashScreen and Network plugin claim to be "not implemented" on either ios and android.
SplashScreen probably doesn't matter, but we do use Network ⇒ fix?
I had referenced in code, which lead to Exceptions being thrown and a IMO misleading "not implemented".
Fixed bynpm i --save @capacitor/network
. I confirmed that network plugin still works;
not sure if splash-screen has any tangible effect, though. -
fixInterkitLiveReload
⇒ properly, cleanly disable live reloaddisable the live update functionality for now. Let's keep the native app support simple and up to date and focus on pwa support going forward? comment
-
remove capacitor plugins file + zip ?
-
-
check if http plugin replaced ok
plus seems like it was explicitly only used in interkit-live-reload.js, indeedthe next iteration of this plugin will be an official plugin bundled with Capacitor 4.x. see
-
check barcode-scanner plugin
don't need it any more, only used by components/v03/QRScannerCap.svelte, which is good becauseThis package is deprecated in favor of @capacitor-mlkit/barcode-scanning README
[although] v4.x supports Capacitor v5.x -
check Geolocation plugin -
update iOS -
including heavy firebase setup
-
-
some .get
fails when "moving legacy localStorage to persistent Capacitor Storage"?
Storage plugin does not exist any more in v5!
⇒ probably move to Preferences API -
update starter -
consider not including the capacitor platform directoriesupdate android + ios dirs; add docsstarter/android
andstarter/ios
.
instead, add to docs how to create them (npx cap add android
) -- this might be even failsafer than editing bundleIds after the fact.. fix splash iconfix app iconfix whatever else we customized
-
- update docs
-
push notification guide -
general native app guide https://docs.interkit.app/guides/howto/native
-
starter prepopulated vs re-initialized dir analysis/diff
cap v2, android
- http plugin setup -- will be moot
- AndroidManifest:
<application android:usesCleartextTraffic="true"
-- missing in reinited - prepop android/app/google-services.json so FCM compilation doesnt choke -- missing reinited, but could be handled by push setup docs?
cap v2, ios
- ios/App/App/Info.plist: english strings re geolocation:
>Turning on location services allows us to mark your location on the map and customize the experience according to your location.
vs
Always allow Geolocation?
(re-inited)
does the user even see this? - ios/App/App.xcodeproj/project.pbxproj -- reinited has more up-to-date bundleId!
cap v5, android
AndroidManifest: (apparently npx cap sync
doesn't set this automatically any more in v5??)
per docs
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
⇒ we'll just keep these; added docs like "remove if unnecessary"
create new starter
- rm -rf android ios
- update package.json & add plugin deps
- main package -> 5.6.0
- remove barcode-scanner, cordova-{file,zip}
- npm i --save @capacitor/{geolocation,network,preferences,push-notifications,splash-screen}
- or is push "optional"? does it need detection to work/compile without?
- npm run build; npx cap add {android,ios}; npx cap sync
on ios:export LANG=en_US.UTF-8
- commit updated files with manual corrections
- cleartext
- google-services.json -- or is it optional and can compile without?
- android location permissions -- i think it could be argued that this is in a way optional, too, when you don't use a Map, you dont need extra permissions...
- create project from
startertemplate-maxi, which uses starter- regenerate template-maxi: in admin, delete it, then admin tools › Build Project Templates
- replace bundleid
- android: capacitor.config.json android/app/build.gradle ios/App/App/capacitor.config.json android/app/src/main/res/values/strings.xml android/app/src/main/java/interkit/app/starter/MainActivity.java
find android/ -type f -exec sed -i -e s/interkit.app.starter/your.bundle.id/ \{\} \;
- android: capacitor.config.json android/app/build.gradle ios/App/App/capacitor.config.json android/app/src/main/res/values/strings.xml android/app/src/main/java/interkit/app/starter/MainActivity.java
-
add andtest plugin-using components- map
- chat
do this for
-
android -
ios
fixes:
-
regenerate starter/server/package-lock.json wtf
-
spin off 1-3 as documentation "in case you need to restart ios/android" -
maybe update docs like this: remove unnecessary permissions from AndroidManifest -
what about capacitor-bundle-viewer
? -
add note to InterkitLiveReload stuff what plugins to re-install