How to detect user location? - mobile

recently I need to detect user location in an app. As you can imagine, there are many (obvious) solutions but I would like to have something like TikTok has in 2021.
After testing their method with virtual and normal devices, with VPN, with GPS mocking, simulated WIFI and Mobile data networks, and email addresses from providers stipulated in different countries, I still could not figure out how they detect my location and thus provide me content. Therefore, I consider their method superior over simple GPS or IP address-based methods. However, I wonder how they do it!
Any idea?

ByteDance (the company behind TikTok) uses your IP address and internet service provider info to get your approximate location, like a lot of other websites do (e.g. Athens, Greece). Google does this too - search anything you want and then scroll down to the bottom of the page. You can find your approximate location there.
I don't know how do they get this info, however, as I have not worked with networks and such.

Related

Getting Locations Best Practice

What are the best practices one needs to know when trying to get the most accurate location coordinates from a user.
How can I explicitly get location using the user's gps? How can I also ensure getting location using the network is accurate? I am asking because when I get location while I am home..by the time I get to the office, the location I get is still the same which isnt supposed to be so. Does it have to do with my listener?
Any help/code snippets will be appreciated.
Salam
Modern Android devices and all iOS devices don't use GPS as much as they use hybrid location. Hybrid location correlates all sensor information (including gps) to give a location as accurately and quickly as possible while reducing battery usage.
This is on by default in Codename One if you don't do anything like explicitly specifying that Google Play Services shouldn't be included or if you include google play services other than location (without including location via the build hint android.playService.location=true) this won't be used either. In those cases Android will fallback to use GPS which is slower.
You can read more about build hints here.
Notice that even then getting location takes time so make a request so you should use the getCurrentLocationSync() method or the location listener API to make sure you get a more accurate reading.

Detect an MSISDN (mobile number) with the browser

Are there any HTTP headers one can use to detect a mobile users number other than this X-header x-up-calling-line-id ?
I want to detect from all browsers as much as possible to cover all platform mobiles.
I will give you the exact same answer I gave to a very similar question as it should provide some insight into what you are trying to achieve.
The ability to get the MSISDN of the user visiting the WAP site depends on a number of things.
Firstly, the user has to be on Mobile Data. If the user is on WiFi then you will not receive this information.
Secondly, the users mobile network has to support the passing of the MSISDN in the HTTP headers.
Some mobile networks send headers on all requests. Others only send if going through a specific APN. Some only send this header to specific IP addresses/blocks. I have even come across networks that send the MSISDN as a $_GET variable. You will need to check with each network that you intend to support.
For example, a particular network in South Africa used to send MSISDNs in headers until around 6 months ago, and in order to receive the MSISDN in the headers now your server address needs to be whitelisted with them.
Also remember that headers are very easy to spoof, and shouldn't be relied on unless you are guaranteed that you are the originator of the HTTP request, such as in instances where you are using Web Views inside of Android Applications - you would need to put sufficient measures in place yourself.
With all of that in mind, here is what you should be looking for:
Look through your headers for any of the following. This is not a comprehensive list of MSISDN headers at all, they are only the ones I have come across in my adventures in mobile development.
X-MSISDN
X_MSISDN
HTTP_X_MSISDN
X-UP-CALLING-LINE-ID
X_UP_CALLING_LINE_ID
HTTP_X_UP_CALLING_LINE_ID
X_WAP_NETWORK_CLIENT_MSISDN
What I do is run through the headers looking for any matches. If I don't find any matches I run through the headers again using a country-specific MSISDN regex against the values to see if there are any potential MSISDNs in the headers on keys that I do not know about. If I find a potential match I add the key and data to a list that I can go through later in order to add to my list of known MSISDN headers.
I hope this has bought some clarity. What is most important to remember is that this is not a reliable method for getting an MSISDN.
Honestly you wouldn't want this feature it all. Suppose you visit couple of web sites and they capture your phone number from the header "x-up-calling-line-id". And these web sites sell your phone number to telemarketers. Do you want to be in that situation?
Technical reason is different. Phone number is never stored on phone (usually). SIM card is identified by IMSI number and Home Location Registry (at MSC) contains an entry that maps IMSI to phone number. So to answer your question, this is not possible.
Use apache_request_headers() in PHP to get MSISDN. but, the users mobile network has to support the passing of the MSISDN in the HTTP headers.

Google Directions for Offline Demo

We are getting ready for a trade show early next month where we will not have Internet access on the show floor. We've put together machines with local installations of apache, mysql, etc. and are using host files to mimic the various domains we access.
But, one feature of our software is using Google maps to get directions from one address in the system to another. In order to show this, I need to be able to spoof a map or two.
I don't need to zoom in or do anything with the map image for the show. Just need to show the rendered map page with the directions list, etc.
I'm not having any luck with browser extensions to capture the entire page to an image. They either crash, or don't get the part of the map below the scroll.
Does anybody have any thoughts on how to get this rigged up for the show - either programatically or using tools that you've tried and found to work?
Amy
just do a screen capture of the whole page
edit: saw the part about not having luck with browser extensions. On a PC, you can try SnagIt, which has a scroll-and-capture functionality. Or, just do it manually and stitch together in photoshop. It can't be that long of a page....

Any way to get the location of a cell phone?

Is there any way to get the location of a cell phone (i.e. latitude/longitude) automatically when the user views a web page? This will primarily be used outside of the United States, so if there is some international standard that the US may or may not follow, that's what I'd need to know.
You can use their IP address to get a general idea. It's not very specific, but it works.
This place has a web service that will let you get their location with PHP or another server side scriping language.
http://www.geobytes.com/IpLocator.htm?Getlocation
There is no standard. The GSM and CDMA phone systems can easily be traced as per their design but you as a non government / network operator cannot trace a cellphone without a user's permission.
Do the words invasion of privacy come to mind?
I know that google has a service that can publish your GPS location if you wish, but this is opt in and you are able to switch it off.
As a iPhone user, I know that there is some applications that actually ask the user permission before geolocating there position. So there might be something in the iPhone SDK.
That way, it is reasonable to think that there is some way to do it.
Firefox 3.5 now supports geolocation, but it's not a very popular mobile browser.
http://en-gb.www.mozilla.com/en-GB/firefox/geolocation/
I'll probably try using Latitude with it's JSON feed.
See Yahoo's Fire Eagle service. Your user would require a Fire Eagle account.

Who supports WTAI (Wireless Telephony Application Interface)

Does anyone know how widely WTAI is supported in mobile phones, or can point to a list of supported devices.
The great majority of device support some WTAI primitives (because they are include in WAP). Those are current supported: WTAPublic.makeCall, WTAPublic.sendDTMF and WTAPublic.addPBEntry
More information here and here.
I came across a couple resources on device capabilities today.
DeviceAtlas
and
WURFL
It depends on what you are hoping to use WTAPI for.
If it is for a wap site then check out Device Atlas or WURFL, or Mobile elements
The next problem that we have is after you have the click to call link, you need to track it we have done this in the past using a service like OnSip.
Whereby each call goes to OnSip then they forward the call onto the correct number they then call to a url hosted on our servers whenever a call comes through enabling us to track the number of people who clicked on the click to call link

Resources