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.
Related
I have not been able to find this in the Phonegap/Cordova docs. Is there a way to tell whether a network connection type is roaming? I want to allow the user of the app to constrain the application to only allow data transfers of a certain type (Data intensive) when on their own network and not roaming.
network = navigator.connection.type only gives you the type of carrier data connection (Or even just CELL on iOS) but nothing about whether the user is roaming.
Many thanks
Ok. In case anybody else comes looking for the answer to this. It seems based on research elsewhere and also what jcesarmobile said, you can't detect this on iOS anyway so that would explain why there is nothing in Cordova for this. While my primary platform for the app is initially Android and it might be possible to create a plugin for that, the ultimate goal is to be multi-platform and there won't be this facility in iOS so for our project we'll drop the requirement.
I'm trying to make a android system app (for me and friends), to let me control my android phone over my server.
Actually I've problem to enable/disable data connection. When I search, I found topic that said there is no possibility, or giving a no longer supported way (by using breach). This was exactly the same for GPS controle, but I found a way because my app is a system app.
So I want to know if someone know a way to enable and disable data connection without user consent on a system app. I didn't find anything on the api.
Thanks !
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.
Our company giving out Android devices to drivers. Our application should never use more then 1Gb by nature of communications we do.
However, some drivers managed to use about 10Gb of data :)
So, I wonder:
Is there any way to track data usage of our app vs other apps so we can notify users and office workers?
Is there any way to DISABLE data access from any app other then ours?
Take a look at TrafficStats, with help of that you can get the amount of data sent/received. And you can get the data by UIDs to see where it was used.
Is there any way to DISABLE data access from any app other then ours?
If rooting the devices is an option then you can use the free Application DroidWall This application makes use of the iptables rules of linux to let you allow / disallow applications from using network data.
Is there any way to track data usage of our app vs other apps so we can notify users and office workers?
As H9kDroid indicates, use TrafficStats. Here is a sample application that takes an initial snapshot of the consumed bandwidth, then takes another one when you tap a button, displaying the overall difference on-screen and the per-UID difference in LogCat. Note that not all devices support the per-UID stuff (e.g., not the Ice Cream Sandwich emulator).
Is there any way to DISABLE data access from any app other then ours?
No, sorry. Eventually, the combination of device admin rules and the new traffic management stuff in Ice Cream Sandwich's Settings app might allow for this, but not presently. Or, you could create custom firmware.
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.