how to open GPS
<p>these are my codes to open GPS </p>

<p><code>
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locationManager.setTestProviderEnabled("gps", true);
</code></p>

<p>and the permission in my xml</p>

<p><code>
&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
&lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/&gt;
</code></p>

<p>but the apps crashed.</p>

<p><code>
01-07 10:41:35.104: ERROR/AndroidRuntime(1823): java.lang.SecurityException: Requires ACCESS_MOCK_LOCATION secure setting
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.os.Parcel.readException(Parcel.java:1218)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.os.Parcel.readException(Parcel.java:1206)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.location.ILocationManager$Stub$Proxy.setTestProviderEnabled(ILocationManager.java:952)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.location.LocationManager.setTestProviderEnabled(LocationManager.java:1054)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.hisoft.battery.MainActivity.connGPS(MainActivity.java:118)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.hisoft.battery.MainActivity.access$2(MainActivity.java:114)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.hisoft.battery.MainActivity$2.onClick(MainActivity.java:62)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.View.performClick(View.java:2364)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.View.onTouchEvent(View.java:4179)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.widget.TextView.onTouchEvent(TextView.java:6607)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.View.dispatchTouchEvent(View.java:3709)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.os.Looper.loop(Looper.java:123)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at android.app.ActivityThread.main(ActivityThread.java:4363)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at java.lang.reflect.Method.invokeNative(Native Method)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at java.lang.reflect.Method.invoke(Method.java:521)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-07 10:41:35.104: ERROR/AndroidRuntime(1823):     at dalvik.system.NativeStart.main(Native Method)
</code></p>

<p>who knows why?</p>
