BlackBerry: Reasons why GEOLOCATION_MODE_WLAN might not be available? - blackberry

Why could GEOLOCATION_MODE_WLAN not be available?
I am using a BlackBerry Bold 9780. The wifi on my device is turned on. Here are 5-10 wifis around and I am even connected to one. I sometimes got a Wlan-fix but I can't get any for a while.
LocationInfo.isLocationSourceAvailable(LocationInfo.GEOLOCATION_MODE_WLAN);
Returns false.
I just noticed that GEOLOCATION_MODE_WLAN is quiet a new thing in Blog: Please refer this blog-post

You can use Google's service instead which is much more reliable and accurate and also accepts wifi data. See here: Cell triangulation on BlackBerry

I finally got it going by setting a maxAge when setting the LocationListener (was -1 => default before):
myLocationProvider.setLocationListener(new LocationListenerImpl(), 600, 300, 30);
I can reproduce this, but is does not make any sense to me... And it does not work everytime. Whatever I give up on this...
EDIT -
It might also not be supported by your carrier.

Related

OMNET++ tk-gui wrong icon placement

I am working with Artery / VEINS (I do not think this matters) and SUMO and OMNET++ :)
As you can see, my OMNET TK-GUI is no longer showing my network correctly, all icons are in the same place!
The World.ned
TK-GUI showing wrong
Two days ago, this was not happening, I could see the vehicles moving around the OMNET TK-GUI.
So, what have I done? I installed the new NVIDIA driver but I do not think this affects.
Any suggestion? :) Have a really nice day!
This is a known issue in Tkenv. For some reason the zoom level gets reset to 0.00x from time to time. Just zoom in (press and hold Ctrl+M) until the network gets magnified to a reasonable size.
Also, please note that Tkenv is getting retired in newer versions of OMNeT++, in favor of the more modern Qtenv interface.

How to check iPhone connection with USB in Programming?

I want to know how to check iPhone connection with USB in Programming.
Many case suggest using check Battery status.
but this case fails in case of charging of iPhone using iPhone charger
so...
May I ask alternative way of this case, please?
And
What return value if an iPhone is connected to iPhone charger.
I've done this before, This is a link to a project I built quite some time ago, I just commented stuff out, have a look to get the general idea, this was a side project that I created to kill time, hope you find it useful, please comment here if you have any questions.
https://github.com/MrHaze/USBDetect
I used NSTask to get a command line reading of plugged in items, then used grep to filter out the word "iPad" or "iPhone", you can just run the command and see what you get, and adjust accordingly.
feel free to contribute.
although this is probably a better way of doing it
If you are trying to find out on the device side, have a look at this link it might help you.

Firefox OS device gps

I'm currently searching a way for device using firefox OS to communicate with device's gps, so it can get the exact location positioning, rather than the w3c geolocation api which is not as accurate as gps realtime.. Thanks!
Simple answer: it isn't possible to access the "device's GPS" directly. You only have the Geolocation API that you already know.
Long answer: My experience with it is not bad at all. So, I think only of two possibilities for not getting "exact location positioning", as you name it:
maybe you're not using the right options to get a precise position. In this case, you could tweak your options a bit to get better results;
maybe you're not waiting until the underlying software can use your GPS instead of some less accurate instrument/estimation (like Wi-Fi positioning estimation).
It can be a combination of both =P
In the first case, you can verify if you're using enableHighAccuracy, like this:
navigator.geolocation.watchPosition(
successCallback,
errorCallback,
{ enableHighAccuracy: true }
);
This will ask the browser for better results, as the standard indicates. Watch out that this may use more battery, and this may not be available anyway. This may take more time too, which is related to my other observation.
In the second case, you may be using a value for timeout that is too small, and maybe it's combined with a maximumAge that may be too high.
If maximumAge is high and timeout is small, you get an out dated position, as there won't be enough time to get a new position and you accept an old one.
If both are small, you'll start to get lots of TIMEOUT errors (the value is 3), as there'll be no positions for you.
You need to find the right balance between all 3 options to get the best positions. And you have to be patient sometimes.
Play with all 3 options and take a look at the errors you get. They'll tell you a lot about your issue getting precise and accurate coordinates.
The position object has some attributes that may come in handy to analyze what's happaning:
the position.timestamp attribute will tell you how old that position object is. If this is old, you know you should tweak the options
the position.coords.accuracy attribute will tell you the accuracy level of the lat/long coordinates. If this is too big (it's in meters), you know you should tweak the options
If you wait forever, on a place where the GPS should work well (say, outdoors, on a clean field), and you keep getting inaccurate results, maybe you can't do much better anyway. I'd say it's not possible anyway, with your software+hardware =(
As of now, Firefox OS only has support for GPS positioning (with the latest addition of A-GPS in the mix). That results in the fact, that most of the time you will have to wait from 1 to several minutes at least for the GPS module to acquire lock on your location, and you will need clear look at the sky for the lock to be acquired.
That said, after a lock is acquired, by using the right settings in the call itself (like setting the enableHighAccuracy flag to true) the GPS should provide as accurate position as any other device would.
Right now cell-based and wifi-based geolocation is not available in the current version of the OS (1.0.1 or 1.1.0, either) but is in the pipeline.
You can use the Geolocation API Firefox OS or Google Maps (I do not remember where I got it)

How reliable is Reachability and should I take further precautions?

A little vague in the title, but I want to know what others are doing about this. I wonder:
If you use Reachability, do you perform any additional checks or are
you fully confident that the notifications will take care of
everything?
Has anyone had any issues with their WiFi working, but
Reachability returning false despite that there's an active connection? (I haven't myself, but have read about it somewhere).
I use it, and have not had any issue with reliability of detecting WiFi connectivity. It has worked fine for me when used properly.

Blackberry application works in simulator but not device

I read some of the similar posts on this site that deal with what seems to be the same issue and the responses didn't really seem to clarify things for me.
My application works fine in the simulator. I believe I'm on Bold 9000 with OS 4.6. The app is signed.
My app makes an HTTP call via 3G to fetch an XML result. type is application/xhtml+xml.
In the device, it gives no error. it makes no visual sign of error. I tell the try catch to print the results to the screen and I get nothing.
HttpConnection was taken right out of the demos and works fine in sim.
Since it gives no error, I begin to reflect back on things I recall reading back when the project began. deviceside=true? Something like that?
My request is simply HttpConnection connection = (HttpConnection)Connector.open(url);
where url is just a standard url, no get vars.
Based on the amount of time I see the connection arrows in the corner of the screen, I assume the app is launching the initial communication to my server, then either getting a bad result, or it gets results and the persistent store is not functioning as expected.
I have no idea where to begin with this. Posting code would be ridiculous since it would be basically my whole app.
I guess my question is if anyone knows of any major differences with device versus simulator that could cause something like http connection or persistent store to fail?
A build setting? An OS restriction? Any standard procedure I may have just not known about that everyone should do before beginning device testing?
Thanks
Just providing the URL will not work. You will have to append some info after the URL to determine the transport method your HTTP connection will use. For instance http://example.com;deviceside=true will use DirectTCP (you might also have to supply APN information but that's saved on the device for my phone). http://example.com;interface=wifi will use wi-fi. On OS 5 there's a ConnectionFactory class that makes this a lot easier. Here's a link that goes into more detail.
This was a tough one for me!
As Jonathan said you have to put some parameters in the url to make it work on the device. You shouldn't do it by hand but use the ConnectionFactory instead.
As you may thing this would just make it work but it doesn't!
The real problem is that not the url has been altered because it has ;interface=wifi;deviceside=true in it (in my case). Depending on the webserver accepting your request this could broke the code.
A solution I tried and that works is try to happend a fake parameter like
&foo=true -> &foo=true;deviceside=true
This will result as a standard parameter for the webserver but your device would use it to driver your connection.
On the simulator this work without this extra code because behind it there is a BIS server for you. On the device (as in my case) there isn't because I'm using a development device unregistered and without SIM (just wifi).
Another point is that the HttpConnection class doesn't handle HTTP 302 Redirect and if you get one you have to handle it manually.
It's probably an issue with the APN not being specified. See my answer for this question for details:
video streaming over http in blackberry
I would make this a comment, but I think I don't have enough rep yet for that... So I'll just answer and hope this doesn't get hosed for just pasting in some links.
I've been working on this exact sort of networking issue on our app this past week, and it is indeed tricky as some others have pointed out. Here are two links which really helped us out using HTTP on different devices, especially older devices which do not provide ConnectionFactory.
http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-connections-to-the/td-p/206242
The first one has some code examples, including demonstration of querying the system's ServiceBook and CoverageInfo classes to make a decision about what kind of connection will work.

Resources