Is it possible to determine whether a phone number is SMS capable or not, i.e. it is a mobile number? I realize that the user can set the type of number when editing the contact, but I'm looking for something authoritative.
Thanks.
You can use libphonenumber for determine if one number is mobile or not, but in some countries ( like USA ) there's no distinction between mobile numbers and landline numbers.
Hope that helps you.
If you're ready to pay then there are two websites I know which can provide you API to lookup whether a phone number is cell phone or landline using NPA and the NXX information (only for US and Canada I think so).
I don't think they'll be smart enough to tell you whether a number is ported from landline to mobile or not. But that becomes unusual case for current market scenario.
1) Strikeiron
2) SearchBug
You haven't mentioned whether you want a system based on US or entire world. So I assumed only US while answering.
I hope this will help little bit.
There are providers like Trestle that provide whether the number if ported and currently it is Landline/Mobile/Fixed or Non Fixed VOIP, etc. That should help determine if the number is SMS Enabled, etc.
Related
Does anybody know what is the limit of sent SMS messages at once? Or it is limited hourly or daily?
I have Nexus 4 (4.4.4 KitKat). I am developing app that sends SMS messages so it is really important to me. I've found a lot of information but it seems none of it is correctly...
Thanks!
According to the creator of this app https://play.google.com/store/apps/details?id=com.bamf.smslimittool.donate&hl=en, the limit, since 4.4.1, is 30 messages in 30 minutes.
It also notes that the limit is present to safeguard against malicous programs, so setting it very high is potentially a bad idea.
In CM11,
Open your Root Explorer.
Go in /data/data/com.android.providers.settings/databases/
Open settings.db your SQL editor
Open the database ‘Global’
Press the Menu button> New Record / New Table
As set name: sms_outgoing_check_max_count
As value (value) type the maximum number of sms you want, personally I put 2000
Taken from http://www.openeducationus.com/?p=101682
Some limit was introduced not later than Gingerbread. As far as I know, and I investigated thoroughly, it is generally impossible to override these limits on non-rooted devices. If possible, those are rare exceptions. But, if your app is supposed to send messages from your device only or from controlled number of devices, you may get around this problem by setting SMS_OUTGOING_CHECK_MAX_COUNT to a huge number (say 99999) in:
/data/data/com.android.providers.settings/databases/settings.db
table secure
table system
/data/data/com.google.android.gsf/databases/gservices.db
table main
I dont think it has got anything to do with Android. In India, it is governed by TRAI Regulations for SMS.
And the limit varies based on whether it is transactional SMS, promotional SMS or personal SMS
*TRAI : Telecom Regulatory Authority of India
I'm currently working on an application where the code uses the device IMEI number as a variable to store something in the DB. We need to see what device the reading originated from.
ie:
String IMEI = telephonyManager.getDeviceId();
However, I'm not sure how this will behave on phones without network access, such as a wifi only tablet. Will is return a unique value? Will it return null?
I know there are alternatives to using IMEI, and I don't need any explanation on what alternative values I can use. I only need to know what will happen when I call this on a phone with no network access. Please do not provide suggestions on alternative IDs or anything other than what I have asked. I appreciate you taking the time to read this question.
Thanks,
-Mark
You get null.
Just ran into this on an app I wrote 3 years ago, and only just converted to tablet format. I had forgotten we were using IMEI (against the advice you and I both received ;-) ) and we started sending a whole bunch of null device IDs to the server.
Sadly it took a whole lot of network logs before I tracked it down to that little hack.
I want my application to work in specific region e.g US.
We can limit distribution of application from play market but i found there are some hacks to install those apps.
I have to somehow limit the use within application.
For that I can retrieve user's GPS location and use Google's Geocode API for first run. But what if user travels to some other region?
I will have to use Location change listener to cater this scenario, but this will drain battery.
If I go for device's timezone, User can change it.
Is there any other thing i can possibly do to restrict application to specific region?
You can also check for the network the user is registered on with TelephonyManager
You have 2 methods that can be helpful.
GetNetworkCountryIso
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkCountryIso()
and
GetSimCountryIso
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getSimCountryIso()
Explanation
getNetworkCountryIso() will give you the iso for the country which the user is currenty registered for.
ie: If you're from Albania (al) and went to travel to USA (us) this will return "us"
getSimCountryIso() will give you the iso for the country where the SIM provider's country code.. ie: If you're from Albania (al) and went to travel to USA (us) this will return "al"
UPDATE
You can integrate (if server side available) http://www.whois.net/ip-address-lookup/ to look for the device IP address. You can get the IP like this.
How to get IP address of the device from code?
With a combination of all this functions (Wifi, network provider, IP, GPS, Google Play regions) you can reduce a lot the use limitations of your app. In the other hand if the user it´s advance enough to fake the IP using a proxy, doesn't turn on the Wifi / GPS and doesn't have SIM card, there´s not much more to do.
Hope it helps :)
As a continuation to my comment, you could go by those lines of filtering users by country code.
The problem - only some carriers store the phone number on the actual SIM card. If so, you will be able to obtain it using
TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tMgr.getLine1Number();
To avoid the instances of those carriers who don't store the actual number on the SIM - there is no way to retrieve the number seeing it is not stored on the phone.
So, what I would do, is simply on the first run of application, request the user to input his full phone number (including country code) - and store that in SharedPrefs. Then, you will know if to run the app or not.
Good luck, hope this has helped!
This question sounds a bit odd, and it is maybe impossible, but I really need to do something like this, and I need a cheap solution.
What I would like to do is to use and Android phone to forward incoming calls to specified numbers based on the extension number. Is it possible virtually? I do not have real extensions, just one Android device with only one phone number, so that is why I am thinking about extension numbers, I think this is the only way to identify the target number with a cellphone.
Sample:
My number: 00491234567
When user calls 00491234567-01 it will ring at 00490987654
When user calls 00491234567-02 it will ring at 00490456789
What you are asking for needs to be provided by the telephone switching network, not the phone itself.
When someone dials 00491234567-01 on their phone, the number will either be rejected as being malformed, or the -01 addition will be ignored and not send via the call control protocols.
Android provides the following method to determine the network operator:
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkOperatorName()
However even the documentation specifically says:
Returns the alphabetic name of current registered operator.
Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).
The problem is that we need a reliable way to detect the carrier so we can identify the traffic source. Has anyone had a similar problem and if so, what is the best solution?
My phone is on Verizon Wireless. On a daily basis, I drive through areas where my phone is roaming and/or has poor reception. Using scripting layer for android, I will log the results of calling getOperatorName() once every ten minutes over the next week.
There is another method that might work in the android.telephony.cdma api. The documentation there is missing the reliability disclaimer. You would only get a Network ID instead of a name. Unfortunately, this requires API level 5 instead of 1 if that matters to you.
Logging the results of the getOperatorName() method yielded nothing special. When I had no service it consistently returned null and when I had service it consistently returned "Verizon Wireless." I'm sure that's not very helpful.
Edit: Addition and correction.
Added - Explanation of link
Corrected - API level 5 not 17
Edit 2: Test results
I am currently looking for a solution for this problem as well. According to this thread one could use CdmaCellLocation.getNetworkId and CdmaCellLocation.getSystemId. Since there are no CDMA networks in Germany, I am unable to check if this works...
You think maybe this was one precurser to Google pulling cdma support? Play within the frameworks or find you another playground is what I hear Google saying. Well that and the fact that carrier apps burned into roms have at times left gaping holes in security.
As to a possible answer to your question... from where are you able to pull info? APN settings might tell you or an assert to a known carrier line in build.prop could pull the info I might need for example. (I do the hobby roms). Then again if you physically inspect a phone, the carrier is usually branded ;) From what vantage are you pulling the info?
Rob