I am trying to create an app which gives signal strength of various mobile networks ,
here is a few things I need to know
1 : I am getting phone signal strength like 13,14,17 using TelePhonyManager ,
what it actually means
2 : So if this declares the mobile signal strength , can the same strength be assumed for data being using using edge , 3G or any other way
i dont need full source codes ,
a little guidance should be sufficient.
Related
I would like to get the overall signal strenght received with the mobile antenna. Ideally, I would love to get the electric field measured with my phone antenna.
I did found a lot of methods to get the signal strength but they all give a specific signal strenth (either GSM, Wifi, GPRS ...) but not the overall signal. Moreover, if there are no SIM card in the phone, the GSMsignalStrength will return 0 or null and even if there is a SIM card, I will only get the strength of the signal of that operator only.
Could you please help me?
I was wondering if you can set signal strength parameters. In andriod.telephony class I only see methods which get you the values, however, is it possible to set values too ?
No. Signal strength is a measurement of a physical thing- the ratio of signal to noise of the cellular signal. You can't set that- it is whatever it is. You can set its variable to 1 billion, it won't effect the physical reality. The only use of it would be to lie to other apps about what the real signal strength is. And no, there is no way to do that.
I tried getting neighboring cell signal strengths like this: Getting CID, LAC and signal strength of all cell towers in range -- however this doesn't seem to be supported with most Samsung phones (just returns blank list). I get a similar result when I run the "GSM Signal Monitoring" app -- no nearby cell info available.
This being said, I CAN access this information if I manually dial *#0011#; ServiceMode pops up, and if I choose "back" and "Neighbour Cell" I can get a number of neighboring cell masts and their signal strengths.
My question is as follows: Is there a way to programatically get this data from ServiceMode, or another way to get this data other than the way mentioned in the url that will work on Samsung phones? The data is clearly there; the question is how to get it.
In my Android application I first get the users location using either GPS, the GSM network or a text value that is manually input via a Settings screen.
At first I used the Geocoder class to get the users locale with latitude and longitude provided by GPS or GSM but it seemed unreliable, now I used Google's web API to get the locale by making a HTTP request and parsing the XML document returned. This is using the following URL:
http://maps.googleapis.com/maps/api/geocode/xmllatlng=blahblahlat,blahblahlong&sensor=true
After getting the users locale I then send another HTTP request to free.worldweatheronline.com's weather API and parse the XML returned. With a stable internet connection the application runs fine, however my house has a rubbish signal and even worse mobile data connection.
I am aware there is a simple method to check if the device has a mobile data connection, however what I want to know is whether there is a way of measuring the signal strength as the problem arises when there is a connection, but it is too bad to successfully run. For example, if there is a way to get mobile data signal strength which returns a value from 0 (no signal) to 100 (full signal), I can then only carry out the location and weather retrieval if signal strength is above a certain amount.
Would it be best to just surround the location and weather retrieval code with a try/catch so it doesn't cause a runtime exception, allowing it to just fail gracefully then update when a better signal is acquired? Any ideas on how to accomplish this, or any other suggestions to make my app more friendly for users with bad signal?
Thanks in advance!
You can check it but remember to handle, in any case, drop of connections.
In my apps I had some problems while writing files or stuff like that with an open connection, so just remember that a fail may always occur (for example switching from gprs to wifi).
If you can easily check the signal strength I would do both.
Give a look at the SignalStrength class (never used it btw). Here a nice explanation.
You can check cell service signal strength by creating a PhoneStateListener and handle the onSignalStrengthChanged callback. For more info look at this question How to get cell service signal strength in Android?
EDIT :
You can pause PhoneStateListener by calling telephony.listen(listener, PhoneStateListener.LISTEN_NONE); to not receive updates when you don't need them.
We have an in-house Android app which is a migration of a pre-existing JME application. There was an issue where users in the field were complaining that the app drained the device battery when it tried to send data when the signal strength was low (this is common behaviour in mobile devices and not our immediate problem)
The data needs to be sent promptly but not immediately, so we placed a check on the signal strength before sending the data. This check used the PhoneStateListener and the onSignalStrengthsChanged(SignalStrength signalStrength) callback as recommended by many similar SO questions and articles elsewhere.
This works fine on my own phone (running on Telstra Australia) and SignalStrength.getGsmSignalStrength() returns a value from 0-31 as expected. On a phone running on another network (Optus Australia) however, it reports GSM is true but returns 99 (ie an error code) when determining the signal strength. I believe this is still correct behaviour since GSM is the 2G data and it is the 3G UMTS/HSPA that should be checked. UMTS/HSPA is the network reported by the Elixir app on the phone, as expected. We have also had unconfirmed reports that my network (Telstra Australia) reports insufficient GSM strength to send data from the application, but is able to browse the internet and perform other data activities without issue. This leads me to believe that the GSM strength is the wrong thing to check anyway.
I am in the process of running tests on other Android phones on the same network (still trying to access some devices) but it is definitely the case that we are able to browse the internet and send (HTTP) data from our application, it just fails if we check the signal strength and always receive '99'. On Optus, SignalStrength.toString() always returns 99 -1 -1 -1 -1 -1 -1 gsm 3 after several days of testing against multiple towers.
The closest (unanswered) SO thread is this one: Getting Signal Strength RSCP and Ec/Io from a phone served by a HSPA network
In summary:
Telstra connection reports GSM is true and returns a usable signal strength
Optus connection reports GSM true but always reports '99'
GSM is possibly the wrong thing to check anyway, we need to try to obtain the 'actual data transmission network strength'
after testing with multiple handsets from multiple vendors and multiple (Australian) carriers, it appears that this behaviour is specific to the Samsung Galaxy S2 and was not seen on the previous version (Galaxy S).