getNetworkCountryIso() unreliable on CDMA network (e.g., Verizon)?

by monkey.jsun » Thu, 19 May 2011 05:01:30 GMT


Sponsored Links
 Here is what Google web reference says:

-------------
public String getNetworkCountryIso ()
Since: API Level 1

Returns the ISO country code equivalent of the current registered
operator's MCC (Mobile Country Code).

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).
--------------

How unreliable is this function and what are the factors that make
this unreliable in CDMA? Is it the network operator (e.g., in one CDMA
network it will always, while it never work in another)? Or is it
related to a particular handset (one handset always works in any CDMA
work while another never works)?

Specifically can someone confirm or disconfirm where this function
works for verizon network?

There are a few other functions in the same shoe, such as
getLine1Number() etc.

Cheers.

Jun

-- 



Other Threads

1. Weird bug in Canvas + TextView

Hi, it's my first time writing here and I want giving thanks everybody
who makes the group possible. Specially to all the Android
developpers. Well, let's go to the problem: I'm trying to rotate a
WebView according with the orientation sensor. That's because below
this view I have a GLSurfaceView wich I don't want to rotate, so as
probably you'd have suppossed I set orientation in landscape mode,
avoiding the automatic rotate of the cell.

To achieve my goal I include the class WebView in another one using
composition. This class is named, in example, ExtWebView and overrides
the onDraw method with canvas.rotate(-90) (after a translate). The
class ExtWebView extends the LinearLayout one. The problems begins
when I decide set the WebView in a non square portion of the screen
(not the whole one). So I add the WebView to the ExtWebView with
"addView(WebView, 200, 300);". In the main Activity I add the
ExtWebView with "addContentView(ExtWebView, new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));" so
it should being able to use the whole screen.

And now come the problem. The rotated WebView appears initially fine
(rotated like expected), but if I slide my finger on it left or right
(coords are changed and works like up and down, but that doesn't worry
me) then only shows on the screen the portion of the View wich fits
into the bounds specified in the WebView with (200,300). In other
words, I rotate in the ExtVebView but it behaves like if I would the
WebView one (cutting the web page to its dimmensions).

However, that's not the only one surprise (not the most interesting
one, at least for me). If I add a class wich extends TextView in the
main activity above the ExtWebView with the methods: setMinWidth(300)
and setMinHeight(300) (both of them inside the overrided onDraw
method) then ExtWebView shows the whole page rotated exactly like
expected, even behaves fine when sliding my finger on it, although the
portion of the web which before wasn't showed and yes now becomes
insensitive to my finger slidings. In a few words, with the
setMinWidth and setMinHeight methods the limits setted to 200x300 in
the WebView disappear. Is this a bug? Is there any other way of
achieving this effect? I`ve been looking inside the code of the
TextView and I think the question it is in the requestLayout() method
but I don't know where is implemented it's code.

Any help will be wellcome.

The code of ExtWebView is:

public class ExtWebView extends LinearLayout {

        public ExtWebView(Context context) {
                super(context);
                mContext = context;
                init();
        }

        public ExtWebView(Context context, AttributeSet params) {
                super(context, params);
                mContext = context;
                init();
        }

        private void init() {
                pagWeb = new WebView(mContext);
                pagWeb.getSettings().setJavaScriptEnabled(true);
                setWillNotDraw(false); //force the use of the OnDraw
method
                addView(pagWeb, 200, 300);
        }

       @Override
       protected void onDraw(Canvas canvas) {
                canvas.translate(0,320);
                canvas.rotate(-90);
                super.onDraw(canvas);
    }

}

The ExtTextView one:

public class ExtTextView extends TextView {
        public ExtTextView(Context context) {
                super(context);
                setText("Weird effect ...");
        }

       @Override
        protected void onDraw(Canvas canvas) {
                 canvas.save();

                 this.setMinHeight(300);
                 this.setMinWidth(300);

                 super.onDraw(canvas);
                 canvas.restore();
        }
}

and we add the views in the main activity with:

ExtWebView.loadURL("file:///sdcard/test.html")  //Loading of the web
page

addContentView(ExtWebView, new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));"

addContentView(ExtTextView, new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));"

-- 

2. Instrumentation testing

hi,
 I trying to write  Instrumentation test cases for my Android
applications.When I was doing this I came across the following
testsuiteconstruction failed error

android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests
testSuiteConstructionFailed(android.test.suitebuilder.TestSuiteBuilder
$FailedToCreateTests)
java.lang.RuntimeException: Exception during suite construction
at android.test.suitebuilder.TestSuiteBuilder
$FailedToCreateTests.testSuiteConstructionFailed(TestSuiteBuilder.java:
239)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:
444)
at android.app.Instrumentation
$InstrumentationThread.run(Instrumentation.java:1447)
Caused by: java.lang.NullPointerException: Method name must not be
null.
at java.lang.ClassCache.findMethodByName(ClassCache.java:297)
at java.lang.Class.getMethod(Class.java:1014)
at android.test.suitebuilder.TestMethod.getAnnotation(TestMethod.java:
60)
at
android.test.suitebuilder.annotation.HasMethodAnnotation.apply(HasMethodAnnotation.java:
39)
at
android.test.suitebuilder.annotation.HasMethodAnnotation.apply(HasMethodAnnotation.java:
30)
at com.android.internal.util.Predicates
$OrPredicate.apply(Predicates.java:106)
at
android.test.suitebuilder.annotation.HasAnnotation.apply(HasAnnotation.java:
42)
at
android.test.suitebuilder.annotation.HasAnnotation.apply(HasAnnotation.java:
31)
at com.android.internal.util.Predicates
$NotPredicate.apply(Predicates.java:122)
at
android.test.suitebuilder.TestSuiteBuilder.satisfiesAllPredicates(TestSuiteBuilder.java:
254)
at
android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:
190)
at
android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:
350)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:
3929)
at android.app.ActivityThread.access$2900(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1859)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4310)
at java.lang.reflect.Method.invokeNative(Native Method)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)

can any one please suggest solution for this?
I need it urgent.
















--

3. SDK setup could not move

4. how to have my custom view class use a layout xml

5. catch-22 for Canadian developers?

6. Semi-urgent request for testing help re. my BBC News app

7. WT Ask - Lock/Unlock N1 Screen