Attempting to set up analytics for a react native app, and was going to use something like https://www.npmjs.com/package/react-native-google-analytics.
An issue though, is that there are times where the device may lose network connectivity. Are there any good libraries/solutions for storing events/views app side, then batch uploading them to something like google analytics?
You could use the actual iOS & Android SDK for Google Analytics, via the following react native bridge - https://github.com/idehub/react-native-google-analytics-bridge
As per docs for iOS & android
If a user loses network access or quits your app while there are still
hits waiting to be dispatched, those hits are persisted in local
storage. They will be dispatched the next time your app is running and
dispatch is called.
Related
So basically I have two iOS apps installed on the same device, and they need to communicate by sending data to each other. I don't want to use URL scheme or Universal links as these two would open the other app in UI instead of sending message to each other in the background. Currently I have a solution of using a unix socket connection by binding one app to a specific port and have another app connect to it. This works fine but I am just wondering if Apple would allow the usage of this.
Note that these two iOS apps do not come from the same developer so anything else that relies on App Group would not work in this case..
Would Apple allow using a socket in this case?
Edit: One of the app is valid to run in background, so background execution is not a problem
No, this is not possible simply because the application will lose network connectivity when it goes into background mode. I invite you to check the following Apple Developer Documentation page related to iOS app background modes:
Background Execution
As you can find on the page, the operating system suspend the app when it moves to background and will then cut several resources including network access.
There are however some exceptions to the rule, which are voice ip apps. These must declare the voip background mode in the plist file to be allowed to keep network streams open in the background.
This question comes a lot on iOS or Android and unfortunately the answer so far is no, we can do tcp client / server communication between apps.
It is totally doable as long as one of your apps has permissions to run on the background. Such example is music apps. Spotify does the same thing with their “app-remote” SDK.
I'm doing research for an app I have to build for our start-up.
I want to build an app that keeps count of the steps a person takes every day by using HealthKit on iOS.
When the user requests a refresh or restarts the app, I can request the latest step count available. However, we want to push notifications to the user as soon as they have taken a set amount of steps (10,000 for example).
So I was wondering if I could set up a listener within flutter, so that HealthKit would (battery efficiently) provide the latest step count as they come in or at a set value/interval.
Is this 'listener'-architecture that communicates between flutter and native Swift code possible with flutter, and if so, is it the best approach?
Is the same also possible on the Android side?
Thank you for your attention.
Perhaps HealthKit's or HKObserverQuery is what you need on the iOS side
Receiving Background Deliveries
Apps can also register to receive updates while in the background by
calling the HealthKit store’s
enableBackgroundDelivery(for:frequency:withCompletion:) method. This
method registers your app for background notifications. HealthKit
wakes your app whenever new samples of the specified type are saved to
the store. Your app is called at most once per time period defined by
the frequency you specified when registering.
As for architectures that
communicates between flutter and native Swift code ... Is the same
also possible on the Android
I believe you are looking for Flutter Platform Channels where you can find a Swift Example.
Flutter uses a flexible system that allows you to call
platform-specific APIs whether available in Java or Kotlin code on
Android, or in ObjectiveC or Swift code on iOS.
Flutter’s platform-specific API support does not rely on code
generation, but rather on a flexible message passing style:
The Flutter portion of your app sends messages to its host, the iOS or
Android portion of your app, over a platform channel.
The host listens on the platform channel, and receives the message. It
then calls into any number of platform-specific APIs – using the
native programming language – and sends back a response to the client,
the Flutter portion of your app.
Unfortunately, I don't see any existing Flutter HealthKit but hopefully the available tools are enough to let you build your own bridge for HealthKit.
Brandon Donnelson's Video on Creating a Plugin may also help.
I am not sure if there are HealthKit alternatives to Android.
When i tried to implement app stays unto 3 mins after socket is not running.
My requirement to develop one socket server app that should be always in background.Needs to communicate with other client apps or safari web browser client .
I need to communicate between server app and other clients apps or other browser.
So, initially user opens the server app and click start server button.Then he can go to other clients apps and get communicate and share valuable information.
In this process server app needs to stay in background continuously for a long time.Untill the user terminates the app.
I saw that app need to use some UIBackgroundModes to communicates like
• Apps that play audible content to the user while in the background, such as a music player app
• Apps that record audio content while in the background
• Apps that keep users informed of their location at all times, such as a navigation app
• Apps that support Voice over Internet Protocol (VoIP)
• Apps that need to download and process new content regularly
• Apps that receive regular updates from external accessories
But i am using only external accessories in my app.That i am attaching some reader to iPhone/ipad device.
• Apps that receive regular updates from external accessories
I saw many links in Stackoverflow, but i dnt get proper answer.
Some links:
socket connection killed after iOS app goes to background
iOS application executing tasks in background
https://blog.newrelic.com/2016/01/13/ios9-background-execution/
Can you guys can suggest me how to keep the app in background??
Thanks in advance
I'm developing an app for a client and am experiencing an issue where the app is still using mobile data on my device, even though I have mobile data turned OFF for the mobile app, and wi-fi is switched OFF also.
The app is a video-calling app, using WebRTC, Sockets (socket.io) and usual API calls. All of these are still being used and successfully returning data, meaning a fully-fledged video call is working, despite the wi-fi being disabled and mobile data being restricted too.
I'd obviously like to resolve this situation, as I fear the app could be rejected by Apple upon submission.
The same experience occurs regardless of whether the device is connected to USB or not.
Only Airplane mode seems to provide the correct 'no connectivity' experience.
I am working on an iOS app in which I have integrated Google Analytics for tracking different events and crashes but what I want is that when my app crashes then only crash report should be sent to google analytics. Let me explain again
if app runs smoothly it should send all the data to google server
if app runs without internet then google caches all the data and sends when internet is available and it should run
now this one is important.
If app runs without internet then google caches all data, but when app is offline it is crashed and when analytics SDK tries to send the data to the server on next restart it should only send crash report instead of all the activity performed by user when he was inactive.