I am seeking some architecture advice within the mobile space. I am wondering what people are today within their applications, say for the iOS, Android, WP7 devices, in terms of web services and instances for caching data when disconnected?
Many of our applications need to work offline due to having limited connectivity, so data storage/caching, synchronization, etc. is critical.
Any and all advice will be greatly appreciated.
If your apps need to work in a limited connectivity enviornment just store everything you need in a database, and have a synchronize option so the user can decide when he has connectivity to update everything or send data back to the server.
Another option would be to have the app monitor for connectivity, and when it is being used and a network is available have it automatically work in online mode and when no network is available in offline mode.
Depending on the level of "limited connectivity" I would just go for the full offline option and let the user synchronize. I develop apps that are used in many remote areas of south america and the full offline option is just better. I used to have issues with intermitent connectivity in border areas where the network would jump between available and unavailable and it made a mess in data transmition.
I can't speak for iOS and Android, but for my WP7 app I store data offline in isolated storage. My app essentially works in disconnected mode so everything is stored offline and at certain events e.g. saving a task the app checks to see if it has a mobile connection and if so synchronizes with the back-end.
Related
The android developer documentation says apps should respect metered vs unmetered network status: https://source.android.com/docs/core/data/data-saver and I believe iOS has a similar data usage mode system that apps should adhere to.
I'm developing an Ionic app and I want to change the timeout time on locally cached data depending on whether data saving mode is enabled or not.
Is there any platform agnostic (or even platform specific) way to detect the data saving mode of a device?
Google searches and the Ionic documentation seem to come up empty, but surely this is basic functionally that most apps have so I apologize in advance if I'm missing some obvious detail about how this is usually handled, this is my first mobile app.
Although detecting whether data saver mode is enabled still seems to be impossible as far as I can tell, the best alternative I've found is using the Capcitor Network plugin which provides a way to detect what kind of connection the device has: "wifi", "celular", "none" etc: https://capacitorjs.com/docs/v2/apis/network#networkstatus
If a future answer can provide a way to get the data saver mode state, I'll accept that instead but for now it does not seem like it is possible.
I'm developing a mobile app that uses WiFi without internet connection (in order to communicate to an IOT device) and it uses cellular data as well (see TL;DR section for more).
The problem -> some devices don't automatically switch their default route to cellular (rmnet interface) while others are capable.
The workaround -> create a *"local" VPN in order to manage and re-routing network traffic via cellular interface (there are apps like Speedify that can do this by assigning priority to interfaces)
The question -> there is a simple way to accomplish this or it's pretty tricky? When I say "simple" I mean the calls of several well documented API and when I say "tricky" I mean to starting read and parse routing table with customized rules depending on every vendors?
"*local" = a VPN without web server or VPN gateway because I'm not actually interested to do the VPN's job (I seem to have understood that I need a VPN level to manage network traffic of others app but I'm pretty newbie of VPN topic)
TL;DR
My goal is to remaining connected to my access point (in order to call its APIs) AND use cellular data for all others requests I.e: login via my backend, use Google Maps and so on.
Handle this scenario it's quite easy because combining network objects, socketFactory and bindProcessToNetwork I'm able to do this.
Troubles come for others app like YouTube, WhatsApp that stop working because as default network they are using my access point without internet (Android doesn't switch default interface to a cellular)
I'm going crazy because seems that each vendor (or Android OS version?) handles "WiFi without connectivity" with cellular active in a different way.
There are certain devices that all work fine (similar to iOS) but there are others that it's a nightmare.
See this question for further details
Thanks for reading, I really love Android but those issues make me sadder every day more and I'm thinking to pass to the Dark Side of mobile development (iOS).
You've the chance to change my mind ;)
We have an Android app with over a million active users. We recently started receiving feedbacks from users complaining that our app consumes huge amount of network data when in background (around 0.5-3 gigabytes in a week).
The app doesn't have any operations in the background except for the push notifications receiver which doesn't have any network calls. the data consumption on the background should be less than 10 megabytes for a week for sure.
Is there a code I can use to help me detect the cause for this data consumption when my app is in background?
Is there a way to limit data access from all SDKs when my app is in background?
In general, what's the best way to approach such a problem?
Thanks
Update:
In our case we found eventually that the source of the problem was from an SDK we integrated with the app.
If you have the same issue, I suggest you look closely at all your 3rd party code in the app, especially new libraries you added.
Second, check all the services that your app define in the manifest, look closely if any of those services can be the source for this problem.
Third, look for places in the app that use network operation with a re-try mechanism, there could be an infinite "while loop" trying to send some data to a server (maybe some sort of reporting or analytics).
You need to inspect the traffic coming over the wire from your devices. You will need one computer and your device connected to the same local network.
Set up a debugging proxy like Fiddler on a machine on your local network and note its IP address. This assumes your app communicates via HTTP.
Connect your test device(s) via WiFi to the same network as your debugging machine.
Configure your Android devices to use a proxy that points to your debugging machine.
Now you will be able to inspect all requests originating from the device(s). Presumably you will have to leave them running for some time to replicate the problem of some kind of periodic background service running and downloading data. However, I can tell you now that push notifications themselves are not causing 3GB of data on a single device.
You can write code for count the data usage as follows.
recived = TrafficStats.getUidRxBytes(uid);// uid is your appID
send = TrafficStats.getUidTxBytes(uid);
TrafficStats.getMobileRxBytes();
TrafficStats.getMobileTxBytes();
TrafficStats.getTotalRxBytes();
TrafficStats.getTotalTxBytes();
and there is good answer you can find here..
App data usage finding
I'm trying to test my iPhone and Android application with poor internet. I remember there was a program I read about a while back that would fake different types of poor internet. Does anyone remember what this program was called or if there is something similar I can use to accomplish this task?
For iOS, as others have said, use the Network Link Conditioner settings under Settings > Developer > Network Link Conditioner.
For Android, just because nobody mentioned this...
use your iOS device to set up a personal hotspot
connect your Android device to the iOS hotspot
I put the Android device into Airplane mode, and then re-enable WiFi (or turn off cellular data, but I find these settings quicker for me to access on my device)
Use the iOS device's Network Link Conditioner settings to adjust the quality of the network
Since the Android device is tunneling through the iOS device's network, it'll be effected by the iOS device's network link conditioner settings.
Super easy, super awesome, and configurable.
The one that I use and recommend is Charles Proxy. You set it up so that your iPhone or Android uses it as the proxy. Then it can throttle your connection to simulate poor network conditions like 3G.
It has a lot of other useful features like being able to track and inspect all your HTTP requests and responses which is really helpful when writing apps that access web services.
For your iOS applications, Apple has a program called Network Link Conditioner for free for Lion users as part of xCode. For your Android apps, you can probably use Netlimiter.
Netlimiter: http://www.netlimiter.com/
A strategy to fake poor internet could be to open up sockets and send data as quickly as you can - the more threads that are doing this, the more of your device's internet access will be taken up, thus leaving less for the app. For example: if you have 1 other thread sending data, your bandwidth will be halved; if you have 3 other threads, only a quarter will be left for your application, and so on...
I imagine that this is the strategy employed by the program about which you read (although there are other ways in which this could be accomplished).
There's the Apple Link Conditioner which is included with all recent installs of the developer tools. It'll be in system preferences once it's installed.
Is there an API for Android that will find other people nearby running the same app? For instance, if you were to perform a "scan" it tries to find other people running the same app nearby. Would it be possible to perform the same task across multiple OS (Android, iPhone, Windows, etc.)?
Or would the best way be to just have the app communicate to a server your location and have a server-side app that pushes a list of others nearby???
My goal is to find an easy way to eventually transmit data between two devices contigent on those that are nearby.
It seems to me that the second option is the best. The other route to go might be to look into the Android's Bluetooth API as continually updating your location with a remote server is costly from a battery standpoint.