Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using firebase with WatchKit

I am attempting to use the firebase database in my watchKit app. I have developed this feature on my iPhone application but have found it difficult to do the same on my Watch app. When I attempted to import firebase into the VC class in watch app, it is creating an error no such module 'firebase'.

Is it possible to use firebase inside a watch app?

like image 306
Hoovin Shmoovin Avatar asked Aug 03 '17 00:08

Hoovin Shmoovin


People also ask

Does Firebase support watchOS?

Firebase library support by platform For the time being, watchOS is community-supported only. See the Firebase Apple platforms SDK GitHub repository for installation instructions and known issues. Note: Though Test Lab has no client SDK, it does support iOS.

Can I use Firebase and MongoDB together?

Firebase Hosting is a CDN for hosting static websites. So it is not possible to host an application like MongoDB server. You can't host MongoDB on any Firebase services.

Does Firebase support swift package manager?

Firebase supports installation with CocoaPods in addition to Swift Package Manager. To your Podfile, add the Firebase pods that you want to use in your app.

Does node js work with Firebase?

Overview. Firebase provides the tools and infrastructure you need to develop, grow, and earn money from your app. This package supports web (browser), mobile-web, and server (Node. js) clients.


Video Answer


1 Answers

Sadly there is no Firebase support for watchOS2 and watchOS3 due to the fact that there's no support for CFNetwork in these versions of watchOS and Firebase is highly dependent on this framework. Source (thanks for the link @FrankvanPuffelen in comments).

You have two alternatives:

  1. Use the Firebase REST API directly from your watch app.
  2. Handle all Firebase communication from the iPhone app and use the WatchConnectivity framework to send the relevant changes to your watch app.

Depending on your exact use case, you could choose any of the two. The main advantages/disadvantages of these two are that the WatchConnectivity framework is quite limited as in when it can be used. Both of your apps needs to be running at least in the background for the WatchConenctivity framework to work. On the other hand, if you choose to use the REST API, you don't need the watch app to communicate with the iPhone counterpart, the watch app can directly get the Firebase data using network requests. However, in this scenario, the network usage will be bigger, since you will need to essentially fetch the same information both for the iPhone and watch apps.

Update for watchOS 6: Firebase Messaging has been released with watchOS support, however, the Realtime Database along with other Firebase SDKs are still not supported. You can track the progress of them in this GitHub issue, which also contains links to the specific feature request issues for the other SDKs.

like image 139
Dávid Pásztor Avatar answered Oct 09 '22 17:10

Dávid Pásztor