mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-02 06:20:14 +01:00
add deviceSupportsSMS() -- which checks phonetype, i.e. that there's no phone.
This commit is contained in:
parent
7dfe5ba8e1
commit
392f4239d7
1 changed files with 19 additions and 0 deletions
|
@ -36,6 +36,7 @@ import android.content.res.Configuration;
|
|||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract.PhoneLookup;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
|
@ -55,6 +56,7 @@ public class Utils {
|
|||
private static final String SHOWN_VERSION_KEY = "SHOWN_VERSION_KEY";
|
||||
|
||||
private static Boolean s_isFirstBootThisVersion = null;
|
||||
private static Boolean s_deviceSupportSMS = null;
|
||||
private static Boolean s_isFirstBootEver = null;
|
||||
private static HashMap<String,String> s_phonesHash =
|
||||
new HashMap<String,String>();
|
||||
|
@ -79,6 +81,23 @@ public class Utils {
|
|||
return s_isFirstBootThisVersion;
|
||||
}
|
||||
|
||||
// Does the device have ability to send SMS -- e.g. is it a phone
|
||||
// and not a Kindle Fire. Not related to XWApp.SMSSUPPORTED
|
||||
public static boolean deviceSupportsSMS( Context context )
|
||||
{
|
||||
if ( null == s_deviceSupportSMS ) {
|
||||
boolean doesSMS = false;
|
||||
TelephonyManager tm = (TelephonyManager)
|
||||
context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if ( null != tm ) {
|
||||
int type = tm.getPhoneType();
|
||||
doesSMS = TelephonyManager.PHONE_TYPE_NONE != type;
|
||||
}
|
||||
s_deviceSupportSMS = new Boolean( doesSMS );
|
||||
}
|
||||
return s_deviceSupportSMS;
|
||||
}
|
||||
|
||||
public static void notImpl( Context context )
|
||||
{
|
||||
CharSequence text = "Feature coming soon";
|
||||
|
|
Loading…
Reference in a new issue