Closed ailic88 closed 2 years ago
Its not possible right now in the plugin, but I will look into what it would take to make it possible. In our cordova plugin we make it possible to call takeOff from the cordova context, we then persist those config values. If takeOff is called again, the config wont take effect until next run. I assume that would work for you?
@rlepinski first thanks for quick response. When you say next run, do you mean on cold start("kill" app and run it again) or you mean on warm start(restart and re-initialise). For my app is not acceptable to keep keys locally, so if you could expose takeOff() method it would be perfect. Do you have any ETA when you can apply this change?
Either, as long as the app has to start the lifecycle again (Android Application#onCreate, iOS didFinishLaunching). The underlying Airship SDK only supports being initialized once per app lifecycle at the moment. And once takeOff is called, we need to reinitialize the SDK during the beginning of the apps lifecycle in order to properly handle notifications.
If you are just avoiding hardcoding credentials in your app, I don't see any problems with this approach. If you are trying to change what Airship app you point to at runtime, thats where things don't work out as nicely.
In terms of an ETA, I can't really provide that right now. I might have some time to try to get it to work this week but it's not trivial what needs to be done. Ill keep you updated.
I made some progress but having issues deploying to devices for whatever reason so I have not been able to verify anything. I am pretty sure I can finish this up early next week and once its been code reviewed we will merge into main where at that point it will be just waiting to be released. We wont do an actual release for a few more weeks because we are trying to add support for a bunch of new things that we released recently, but you could point to main/sha with the change to start using it early.
https://github.com/urbanairship/airship-flutter/tree/GH-115
I am only exposing app key/secret in flutter for takeOff. The SDK will combine the config from the airship config properties with the key/secret in flutter and try to use that if it is valid. That way we can avoid trying to expose all options for both platforms in flutter.
Credentials in the airship config file take precedence. For example, If you hardcode developmentAppKey/Secret
but try to set a different set of credentials at runtime, they will be ignored for debug builds. Seemed useful to be able to override it like that but if you have other opinions I would love to hear them.
@rlepinski this works for me. You can close this issue when new version with the changes is released. Any idea when it could happen?
Working on wrapping up the release. Hopefully we will have something this week.
Fixed in 5.3.0
Is it possible to fetch "productionAppKey" "productionAppSecret" from remote source at runtime and do initialisation? Or this data has to be part of "airshipconfig.properties" and "AirshipConfig.plist" files respectively for Android and iOS?
What Airship dependencies are you using?
4.4.0
What unexpected behavior are you seeing?
There are no methods exposed for set configuration at runtime