I'm having a very weird problem with fetch on React Native.
I don't know if it's a question for here but I'm trying anyway!
I'm using FETCH to fetch data from my API. Each time a FETCH is run, I run a setTimeout which allows to abort() the current fetch after 30 seconds if there is still no answer.
On iOS, everything works perfectly, however, on Android, I regularly have fetch timeouts.
As if the fetch crashes from time to time?
I really don't understand where it can come from, maybe there are ports to open on the native android side? Or does Android have a different network management compared to iOS that I should know about in order to better manage the connection?
Could using Axios instead of fetch solve this problem?
Edit: My API is in https and I also added the line 'android:usesCleartextTraffic="true"' to be sure it couldn't come from there, but the fetch is still wobbly.
I hope I made myself clear!
Thank you for that,
Viktor
Related
I'm working on something where my iOS app will give 2 input parameters to some server side setup. The server side will periodically run a google API network call and get its result response X. When this X is the right answer, I want the server side to send my iOS app a push notification. This needs to happen for every app user individually.
I know the iOS coding part, and also know how to setup a iOS push notification.
But what’s the best way to setup this server side code? Are there some free cloud instances that I could use?
I’ve looked into Firebase and Google Cloud console that I can combine with a cron job to make regular network calls, but they seem to have a fair bit of complexity involved (especially since it’ll be inputs from per app install so it'll become one cron job per app install).
Is there a better way to achieve this?
figured it out.
for future visitors, i’m writing how i achieved it -
the client sends inputs to the firebase DB, and a firebase cloud function scheduler periodically reads those values to calculate output from google api call. when the output is right, the firebase cloud function sends notification to the client
My goal is to listen only and not modify the outgoing call event and send GPS coordinates to server from background. I'm not even interested in phone number being dialed, what I only need to know is whether the current call is Emergency call.
I've accomplished this easily in android, by following this tutorial.
However some googling showed that, this is a big pain in the ios world.
The only solution I think is to write dialer app from scratch and manage all the events by myself (if that's even possible), but I think it's too overcomplicated
I'm completely new to ios and please let me know, how would you solve this problem guys?
There is no way this will be possible on iOS unless you were planning to release and app for jailbroken phones (and even then I'm not sure it is). The Core Telphony framework has the methods you can use: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/CoreTelephonyFrameworkReference/index.html
I am in the process of developing a Twitter App on iOS, which will connect Twitter API in every 15 minutes, to Collect some data. I'm really not planing to have any server side script to Collect that data as I want everything inside the app itself.
Any idea on how to keep the app Running in Background?
Thanks.
You can follow the Apple's guideline before proceeding to create such background jobs. If it fits with all such requirements then you can go ahead. Follow this link for further details:
https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html
i have created an phonegap app for IOS that tracks the position of the user. At this time it is possible to use it in the Background. But if i like to upload theses data to an Server it will only work when the app is in the foreground.
Is it possible to call a js function in the Background or another way to transfer theses data to an REST Server in an continous Intervall, when the app is in the background?
I has searched for many times about this problem and i can't meantion that nobody has it in the past. I read many about plugins for phone gap, but don't understand how to create on that could help me.
Sorry for my bad english
In short no - IOS only has limited background processing for 3rd party apps.
You can get limited background processing with a VOIP app or using push notifications but I guess this isn't suitable for you
I am looking for ways where my RESTful web service can let my iPad app know to update its cached data when the server's data has been updated. The server is running on Tomcat & Apache Jersey.
Is this doable? And not using Apple Push Notification (APN)?
There are essentially two options: heartbeat check from the app to the server (on a timer) or something that keeps the line of communication open, such as web sockets. Here is an open source web socket for iOS, but I have not personally experimented with it:
http://code.google.com/p/unitt/wiki/UnittWebSocketClient
I'm not sure why you want to avoid APN, but this really sounds like what it's made for.
If you want to update only when your app is running, there are other options (straight forward polling comes to mind), but if you want the user to be notified even when the application isn't running, there isn't really any other Apple approved way to do it.
Can reverse the design around and make your device a client and pull data from a REST service at a regular interval?? With all the support one gets from REST, it might be helpful to know you will have complete control of when data is being pulled by the device from server and exactly the data that might goto device.
I'm curious to know your thoughts, Thanks.
I'll be building a web-syncing iOS application soon, and we're going to use RestKit. Take a look, it might be a big help.