Is there a way of knowing client user operator/network/internet provider

I know this is much more of a server side worry, but I am sure there might be a way of doing it.

I am trying to make a mobile application that at start reads from which mobile company telecommunication company is the client a subscriber, whether BT Group, T-Mobil and so forth.

This kind of info can be retrieve on a server but I want to lower the tasks of the server by getting them from the client’s phone directly.

I tried to read about where I can have this kind of information in haxe but I still haven’t had a single clue.

No idea either but if you’re doing this to lower the load on a server you could just cache it, if you don’t have it or if the data is too old ask the server otherwise no need.
Considering the kind of data you’re looking for it’s unlikely to change too often.

Ok, if I get it right,
the app on the client phone must send a request to the server, which can be done using the haxe HTTP class.
and the server will respond with the data that I am looking for and cache it somewhere.

This is in case the data I am looking for doesn’t change much…

now here is where things get a little more complex:
in this country of mine there are plenty smartphones with more than one sim card.
and user can switch at own will their main operators.

And that is where I get much more confused and lost.
Help please.

Is it for Android target? I think that you can get this info locally from the sim (instead from the network). A quick search shows that there are functions to retrieve this info:

You need to implement a native extension to access these.


Also for iOS


Thank you very much Sir Carlos,
I couldn’t hope for more.
And yes Android is my main target.

1 Like

ok now, I have a problem with the extension.
I went on I Call haxe! to see how to create Openfl Extension.

and made a sample of the tut by:

  1. I run the command:

    lime create extension hola

  2. browse through and write my codes in

  3. wrote some codes to call my static method in using jni in Hola.hx

  4. as I am just targetting Android I stopped there and imported the whole folder in my project.
    lastly in my application.xml, I include the extension using:

  5. call my static method from Hola.hx into my Main.hx

  6. on flash develop I click on debug for android

and bam I get an error saying:
Error: Source path "hola/ndll/Android/" does not exist

which is true, there are no folder Android nor file
Now what I don’t understand is what is supposed to be in and what is it for?

Oops! Forgot to mention that you should disable the NDLL (as long as you’re not using it, at least). Open hola/include.xml and change this:

<ndll name="hola" />

To this:

<ndll name="hola" unless="android" />

…or just delete it entirely.

1 Like

Thanks Very much now it is building the apk

Yes, if you are only accessing Java through JNI you don’t need the ndll.
The ndll can be used for extensions written in C++ compiled with the Android NDK (not Java).

I should have read your post long ago, it would have saved me a lot of time.

After deleting the ndll line in include.xml, I tried to debug for android, but I got some errors,

In fact, I got stuck with my java class at trying to use Context.getSystemService at

TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHONY_SERVICE);

I didn’t realized there was a Extension.mainContext to be used when there were needs of the abstract class Context.

TelephonyManager tm = (TelephonyManager)Extension.mainContext.getSystemService(Context.TELEPHONY_SERVICE);

and right after this one fixed, the ndll came making my app lag on android.

I figured out while just trying it on neko (out of curiosity) that there were some sample lines in hola.hx that were calling cpp functions. Which got fixed earlier today.

In conclusion, I can now play around with android.

Thank you very much for you help.

1 Like