Bit of a background: I'm currently working on an app that uses CloudKit in it's WatchKit extension and I was wondering what would be the best way to receive (push) notifications about changes from CloudKit.
In the corresponding iOS app, I use a custom zone subscription to get (silent) push notifications for changes but since the whole CKSubscription API is not available on watchOS, I can't use that.
So, here are my questions:
1) Is there a proposed way of receiving updates from CloudKit? How am I supposed to know that I have to pull changes from my database?
2) If there is a way to know about the changes, how should I download them? The handle(_:) method can handle NSURLSession but it doesn't seem that I can do some CloudKit operations in there (although Apple mentioned that it's built on top of NSURLSession).
Any help would be greatly appreciated. Thanks!
Related
I am working on a mobile application, this application has some features like users can follow each others, adding comments or reviews, like something .. etc.
So the requirement is we have notifications icon in the app, when the user click on it a list of notification will show up, taken in consider those notifications should be real time.
Many things comes to my mind will reviewing this feature, like using firebase to send the notification, or I can develop internal notification service for this purpose.
The question is what do you suggest guys, do you think using firebase is a good idea for such case? or there is something else you recommend for such case
Thank you in advance.
You can try signalR more manageable than firebase but you need to know programing to manage signalR
So, on watchOS, I know you can schedule (and reschedule) a WKRefreshBackgroundTask to do work for you in the background. This is great for my app to make sure that data is current and up-to-date on watchOS - especially since it doesn't receive updates like iOS and macOS.
Except, my data uses CloudKit to store a user's data.
I want to use something like the URLSession scenario, where you schedule a WKApplicationRefreshBackgroundTask where you create a background URLSession task and hand it to the system. The system in turn hands you a WKURLSessionRefreshBackgroundTask where you check if your data completed its URLSession (by checking if the downloaded data exists).
My question is, how do you do something like this with CloudKit?
I could just do the downloading of my user's data in the WKApplicationRefreshBackgroundTask, but I don't think I'm guaranteed it will finish in the time the system gives to my app. This is why (it seems) Apple recommends you split this into two Background Tasks:
WKApplicationRefreshBackgroundTask - to create the URLSession and hand it to the system.
WKURLSessionRefreshBackgroundTask - to act upon the data downloaded from step 1.
I am not sure you can do this with CloudKit? Or, at least I can't seem to find something of the sort.
If you want to use WKURLSessionRefreshBackgroundTask you have to access the iCloud database via URLSession. This is possible from an app but much more complicated.
iCloud web service documentation
send a web request to iCloud from a swift app
Don't forget to get your API request token for your database on the iCloud dashboard if you want to try it out.
Is it possible to get data from Healthkit the same way as you would query regular API (With user's consent) to store in my webapp?
Something like: healthkit.com/api/v1/user/GetWeight
If yes, where can I find a list of available methods?
If not, are there any workarounds?
You'll have to build:
your own REST API service to store and retrieve the desired data;
an iOS app that accesses the data on-device using the HealthKit SDK and POSTs it to your API.
Neither step is trivial. Good luck!
An alternative may be to install Google Fit on the iPhone, which would connect to healthkit and sync that data to the cloud, which can then be queried via Fit's REST API https://developers.google.com/fit/rest/
If it's a REST/json API you want it's not available and i guess it never will be.
HealthKit is just a standard API available in the IOS8 SDK accessible from application running on a iDevice and written in objective-c/swift.
Not sure if this question is still relevant for someone, but now you have the option to use shortcuts to gather the desired health data and post it to your own api, also you may use automation in order to make it all happen without any hustle.
I've been going around in circles today trying to figure out the best approach, but I'm still lost. Hoping someone here or the Telerik forums has the answer.
My user has a group of records with dates. I need to send a single push notification to the user for each unique date in that data.
I can create this push notification on the client side (appbuilder hybrid app) when a record is created. However, the client sdk for notifications only exposes create, not read or delete. That means -
I can't make sure there's only one notification per device, even if there are multiple records with the same date.
I can't change/remove the existing push notification if the date in a record is changed.
I thought about using Telerik Cloud Code for Data... But the sdk doesn't expose read/delete. I'd have to read all notifications for that User Id from the REST service and then determine which need to be updated/removed. That sounds like a mess of code for a scenario which I would consider somewhat normal. I'm also concerned about timing out, since there's a 5 second limit on cloud code for data.
So, what's the best way to manage my push notifications in Telerik backend services?
The question was answered in the Telerik Developer Forums here -> link
I'm evaluating Urban Airship as a push solution and I was wondering if it's possible to export my device tokens should I decide to stop using their service?
I've noticed they have an API endpoint to download device data (http://docs.urbanairship.com/reference/api/v3/device_information.html#device-token-list-api) but I was wondering if anyone actually went through the process of switching their push solution from UA to an internal solution (i.e. run my own push server and ping old users).
Thank you!
I'm not sure if there is an API call for it, but you could go to Audience->device tokens, and make a script to fetch all of them.
In the company I work, we decided on a different approach.
All communication with Urban Airships goes through our own backend, where we at the same time store the devicetokens sent from the device. That way we can shift to another way of sending push notifications without modifying our apps. It is of course a bit more time consuming to do the initial development. On the other hand, if you go for the solution you are currently considering, the switch to you own implementation (or another push provider) will properly require several migrations, or at least maintaining two different ways of sending push notification for a considerable time.
BTW:we have been using UA for almost 3 years, and have been very happy with their service.