Android Development CellID in LTE network - java

I try to implement a function into my Android Application that finds out the cell id of the cell I'm in in a LTE network.
I recently read a lot about using TelephonyManager.getAllCellInfo() and then filter for CellInfoLte, but also that it's not implemented on every device.
So in my case calling telephonymaganger.getAllCellInfo() returns null.
I'm testing with a Samsung phone, what seems not to be the best case.
Is there any way to find out the Cell ID or is it just not accessible yet?

I had same problem a few months ago when using getNeigbouringCells() and finally I found this:
The cellid implementation varies from mobile device to mobile device
since these features are considered to be optional. for example:
Samsung (all devices): getNeigbouringCells () is not supported at all
and always returns an empty list.
Please take a look at this for more information:
http://wiki.opencellid.org/wiki/Android_library
You can check it with another phone but not Samsung phones. You can find so many reports about other vendors that have the same problem.

Related

What will happen when getSimCountryIso() is called on Android Tablets?

In my Android app, in order to determine certain features, I'm checking a device's ISO country code using getSimCountryIso() and getNetworkCountryIso().
Tested this on my real mobile devices and emulators and all returned certain values without any errors.
One of them is my daily driver phone which has a SIM card in it, but the others have no SIM cards. So at first, I thought both getSimCountryIso() and getNetworkCountryIso() always return some values, but now I'm in doubt because all my real devices used to have SIM cards once and emulators may differ from real ones.
I wonder what will happen when those are called on real Tablets which NEVER HAD SIM cards in them and have only WiFi connections. Can I always expect a certain value? Or an exception or null?
I thought you would get a NullPointerException, but having tested it on a tablet - Pixel C, running Nougat - I actually got back empty Strings for both TelephonyManager.getSimCountryIso() and TelephonyManager.getNetworkCountryIso().
I had assumed the result would be an NPE because calling PackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) on a tablet will return false. That was enough to tell me that you shouldn't be trying to get SIM or network country codes this way on a non-phone device. However, if you try to retrieve the TelephonyManager using Context.getSystemService() on such a device anyway, you still get a non-null TelephonyManager - it just won't be helpful in providing a sim or network country.
In my opinion, if you are dealing with a device that does not have the Telephony system feature, you ought to consider using GPS location, or the user-set locale if you really don't want to encroach on location permissions and can tolerate the user-set locale not being where the user necessarily is.

Android - getAllCellInfo() returns corruped values

I have to implement an android application to get information about the cellular network, like signal strength, cellId and radio access technologie.
My implementation is close to this example: https://stackoverflow.com/a/38176434/7822319. I just added the parameter ASU to each technology.
I have a similar problem like mentioned in this post with my Lenovo Tab2 A10-70L with Android 5.0.1. The method getAllCellInfo() seems to return wrong values.
The dBm value varies around 400 dBm. The ASU level is always at 97.
The SIM-Status in the android settings shows the supposed right values -98dBm and 42ASU.
Does anybody know a solution for this problem ? Or is there a way to get these values on another way ?
Thanks in advance.

Bluecove : check if device is paired?

I am new to using Bluecove API and it seems that after a lot of research, I still cannot find a way to check if a RemoteDevice is already paired to the running machine or not.
First of all, I successfully manage to start a scan however, I find it strange that Bluecove does not offer a way to only look for devices that are in discoverable mode hence the need to check if paired or not ...
To be more precisded I am "translating" a project that I developped in C# using InTheHand.dll for Bluetooth management. This assembly is great and helped me achieved what I wanted to do : scan for devices in discoverable mode and in range, initiate pairing process, handle data via Bluetooth streams.
I need to do the same thing with Bluecove.
Why is it so hard to find answers ? The documentation says almost nothing about pairing although I managed to pair a device I knew was not paired via RemoteDevice.authenticate().
Anyway to summup :
How to start a scan for only devices in discovery mode ?
How to find out whether a device was already paired or not ?
Note :
using both RemoteDevice.isAuthenticated() and RemoteDeviceHelper.implIsAuthenticated(remoteDevice) always return false regardless of the paired status.
Note 2 :
Furthermore, having a lookg at RemoteDeviceHelper.javafrom http://bluecove.googlecode.com/svn/trunk/bluecove/src/main/java/com/intel/bluetooth/RemoteDeviceHelper.java , there is a private property for boolean paired.
It seems no public method will use it ...
Even weirder and desperatly frustating, in the debugger mode, looking at a specific RemoteDevice, I can see the value of this property. It is indeed false when device is not paired, and true if device is paired ! So why can't the API tell me so ?
What should I do ? Thanks for the help !
List of paired devices:
import javax.bluetooth.*
...
RemoteDevice[] rdList = LocalDevice.getLocalDevice().getDiscoveryAgent().retrieveDevices(DiscoveryAgent.PREKNOWN);
Get name & address of paired device:
rdList[0].getBlueToothAddress();
rdList[0].getFriendlyName(true);
Some comments:
list of paired devices can contain multiple devices having the same name
boolean parameter of getFriendlyName() means if agent should query device for its name, but returns cached name if device is not available (at least my tests showed that)

Device Tokens are different from one device to another device

Hi i am little bit confusion about Device Token so can any one guide me. I am using following code for getting DeviceToken.
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)dt
{
}
The above code is working fine and it is showing DeviceToken data ,that is 64 length data.
My doubt is Device Token is different from one device to another device.
If once we got DeviceToken using one device that same DeviceToken can use for another Device.
Of course the device token is different for each device. It identifies a unique device. It's like a phone number (actually it's even more unique than a phone number, since multiple phones can have the same phone number). If it was the same, how would the Apple Push Notifications server know to which device to send your notification?

Android Id and its reliability

I want to generate Uuid for my app so I tried many methods for this.
1) Getting Serial number of device using android.os.Build.SERIAL(this returns "unknown" as result)
2) Dealing with device id (I don't know what it will return in case of tablet devices)
3) Getting Android id using android.provider.Settings.Secure.ANDROID_ID(seems some problem with android 2.2 version)
4) Generating Uuid using java.util.UUID
5) Generating pseudo Uuid using android.os.Build properties
All these methods shows some problems. So I am confused which to be choose? Can anybody suggest me best method?
Android Developer Blog says android id will be unique
Also I heard Android id of device can be changed on factory resetting or os updations .
So is there any chance of for duplication new android id generated during factory resetting or os updations ?
NB:Suppose A Condition
My question is what will happened same 2 device Model of same manufacture will under go restore or os updations.the Android id will change. I am asking about this new id. Will there any chance for android id be same in both device?
The ANDROID_ID is generated each time you initialize the device (after reset, etc.). It doesn't depend on model, serial no., etc. Even if you have two identical devices, their ANDROID_ID's after reset should be different. The ID is not particular special, except that it is global for the device. You can achieve the same thing with an UUID for your app.
Yes, there is a chance of duplicate ID's, but it's negligible.
There's 2^64 possible values for ANDROID_ID, and they are generated with some random function. But it is very very very unlikely that you will ever see a duplicate value - search for discussions about GUID uniqueness to get the point.
In short: you can assume that ANDROID_ID is unique.
Creating unique id's for android device has been discussed vivdly in this link In short use this.
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);

Categories

Resources