Reputation: 129
Background: My company currently has an iOS app built on a firebase / google servierless backend. We use callable functions extensively to centralize common business logic in the backend for reuse with our web app. We also have future plans for Android app development and would like to leverage this centralized business logic.
Problem: Many of our users use our iOS app in places where internet connectivity is limited (typically large concrete buildings).
Need: Is there a preferred approach to bundle cloud function JS code on device, similar to how custom TensorFlow Lite ML models can be bundled on device. Ideally the iOS app would call callable functions first then call bundled on device functions if internet was unavailable.
In short is there an architectural pattern to solve this problem similar to how it's solved for TensorFlow Lite, but for more rudimentary functions or algorithms without the ML overhead. Bonus would be a solution that works within firebase's existing solution set.
Upvotes: 0
Views: 44
Reputation: 599001
There's nothing built into Firebase (or Google Cloud Functions) to run your functions code on the device itself. It's technically definitely possible, but it's just not part of the product - nor does a quick search show an effort from someone in the community.
It's not an unreasonable request though, so I'd recommend filing a feature request so that the Firebase team can consider it in the future. Until that time, you're on your own though.
Upvotes: 1
Reputation: 317487
Cloud Functions runs only in the cloud. There is no on-device execution. An internet connection is always required to invoke callable functions.
If you're asking if there is a way to run some common code on device in a multi-platform way, that's off-topic for Stack Overflow. Please do some web searches or ask around in discussion forums to solicit some ideas.
Upvotes: 1