Made an Blackberry application with XMPP backed for receiving real-time messages for the users, expected to give a feel like push message to the top business users for some key events happens in desktop ERP system by the endusers.
Ok let me go to my doubt..
Sockettimeout, max is 2 mins..handled by listening for the connection failure and getting reconnected..will this cause high CPU usage?
Listening for xmpp messages with idling socket connection...will this cause high CPU usage..in-turn high battery consumption and any performance degradation..
Do we have any tool to identify the CPU and battery consumption by the APP on device or simulator?
Please help me out...
Rgds
Balaji
Finally I am able to get some clue of CPU usage of my app through BB Simulator ported on 6.0 OS, clearly its show the CPU usage during the application activities.
In OS 6.0 you can findout this option under Options -> Device -> Application Management.
During idling socket connection 0% CPU consumption.
When a message arrives through XMPP socket consumption goes upto less than 1 to 1% CPU.
During reconnection after socket timeout consumption takes standard of 7% CPU.
On the average very less consumption, hope my apps wont drain my customers batter :).
Hope this detail will help others in the app performance point of view.
Related
Our app uses web view to render web UI, operating system occasionally kills this process. I know this can occur when there is high memory usage of the process - I am wondering if it can happen from some other reason? - or is there a way to get some more information on why process was shut down? - if memory is exceeded, for how much and what was the limit?
Currently main application process is notified through webViewWebContentProcessDidTerminate callback - there is no additional info on why it was terminated - in some cases it happens after a minute or so of usage - there is no time to ramp up memory usage to be very high even if there were memory leaks.
I can cause this problem to happen sometimes if I use app for extended period of time - in other cases I see from the logs that this happens to our users after only couple of minutes or less of usage - not sure how to debug that further.
I'm using BLE connection and app needs to run in background forever. For now background mode working, but limited, after few hours system kills app without any notifications and appDelegate methods calls. I checked ram usage, and it not depend, system kills app when ram usage 60mb, and when 200mb. Also app periodically sent POST requests to server(every minute) and using location services. How to extend execution time? Is it possible to run app forever(if user not using other apps)?
The answer is NO, iOS is doing dark magic to optimise resources usage and we can't do anything about it.
I am looking at speeding up the connection time between my iOS application and the peripheral.
I have looked up Apples Documentation on the subject: https://developer.apple.com/library/content/qa/qa1931/_index.html
Originally (prior to reading the doc above) I had the advertising interval set to 2 seconds to, what I had thought would be, a good compromise between power consumption and connection time. Having read the documentation further I have changed the interval to 1285 ms.
#define ADVERTISING_INTERVAL 2056 ble_obj.setAdvertisingInterval(ADVERTISING_INTERVAL);
The device is always discovered quickly by the app but the problem comes when trying to connect.
However, I have seen no increase in speed in connection time between my application and the peripheral device. Connections between the devices can take anything from 3-4 seconds up to 30+ seconds.
Is there something I am missing? Either on the peripheral or the central side?
Peripheral BT chip is the Nordic Semiconductor NRF51822.
On examining the devices advertisement packet on the Nordic Semiconductor app I can see that the advertisement interval normally varies from 1275 ms to about 1295 ms (as expected? due to the random time added to the advertisement packet)
NOTE
Have also tried with an advertising interval of 152.5 ms and am still not seeing any major improvement in connection speed. I am , obviously, seeing a marked improvement in speed of discovery
What you observe is normal. Don't expect fast connection setup with an advertising interval of more than a second.
Core Bluetooth uses a high duty scan window/interval for the initiation the first seconds. If it doesn't connect then it continues to scan with much more power restrictive parameters.
I'm developing an iOS app that connects to a certain type of BLE device, but I'm writing the code in a room that has 20+ such devices sitting around, powered up. I consistently find that in the morning, I can connect to my personal device just fine, but as the day wears on, it becomes impossible to connect to my device, as if the 20+ other devices have woken up somehow and are blocking my signal. No one is using most of these devices; they're just sitting on tables. Is this a known bug? Is Apple working on it?
Are all the devices Advertising?
If they are advertising with say 20ms then it could be difficult to hear all. There are "only" 3 advertising channels to share between all devices. The connection happens on the same channels (the peripheral listens after it's own advertising to hear if someone want to connect).
It has nothing to do with Apple CoreBluetooth. In my experience CoreBluetooth can handle around 20 devices after connection has succeeded and the activity has moved to the traffic channels.
1) Try using a slower advertising interval. This should work okay if your app is in the foreground.
2) Use a BLE sniffer (TI USB dongle is fine) and see if connections fail on protocol level, then it is not CoreBluetooth's fault.
3) Only advertise with fast interval when needed or you really really need a fast discovery.
As a rule of thumb apple needs up to 55 advertisements in background mode to see a device when it's the only one visible. So if you really need around 1.1second discovery then you might need 20ms advertisement interval, else use 100ms or even more (see Apple advertising interval guidelines for the exact number that will optimise discovery)
100ms gives so much more capacity and not too bad discovery.
1-2s gives a much longer battery lifetime and will be found in 1-2 minutes if your app is in the background. This would be quite fine for eyeBeacons in malls or the like while you might want 100-200ms in smaller areas.
I'm building a portion of an app that will require the user to download files of varying size. Currently, I'm using Apple's Reachability code to let me know if I have a connection.
(http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html)
While the reachability code can keep track of 'having a connection', it doesn't have an ability to let me know of a worsening connection. It would seem that I need to expand on the functionality of the Apple code to meet my requirement. Is it possible for me to measure the number or percentage of dropped packets during the data transfer? This would be helpful so I could message the user and be able to pause or stop the download.
There is no iOS API available that hooks deep into the networking stack that tells you when and why packets are dropped. It could be dropped at a router or it could be dropped locally because of a checksum error.
What kind of data is it? I assume TCP.
You might be able to infer the quality of the connection by examining the throughput rate. You can count how many bytes you receive per second.
TCP has something called congestion control and the end hosts (iOS devices) will throttle back their throughput as packets are dropped and go unacknowledged. So throughput may correlate with network quality. However, your throughput rate may vary for many reasons such as network congestion, packet shaping, QoS, etc.
iOS does not have a public API to monitor the wifi signal strength. There is a private API but your app would not be approved in the app store if you use the private API.