Possible Duplicate:
  ICS Android enable gps programmatically? [closed using an alternative approach]  




I was using the code below to enable and disable GPS programmatically and worked perfectly in 2.2 and 2.3.

Intent i = new Intent();
i.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); 
i.addCategory(Intent.CATEGORY_ALTERNATIVE);
i.setData(Uri.parse("3"));     
context.sendBroadcast(i);


However, when trying to use the ICS (4.0) realized it did not work. Then I discovered that it was a bug as link below.
http://code.google.com/p/android/issues/detail?id=7890

I believe we have fixed in ICS.

Could anyone tell me if there is an alternative to solve this in ICS?

I think an OS ridiculous "open source" have so many restrictions. I'm already starting to regret having opted to develop our applications on Android.


Question: geometric margin derivation with unit vector?
Answer: This is because dist(A,B) is a scalar. What you need is a vectorial operation to infer the position of a point from another point in the space, so:

point(A) - Vector(W) = point(B)


Therefore, you need to convert the scalar "dist(A,B)" with the magnitude |dist(A,B)|, into a vector, with the direction of W to be able to perform the operation above.

Therefore, Vector(W) above would become:

Vector(W) = dist(A,B) * unitVector(W)


Leading to the equation proposed by the author.

Please let me know if this is clear enough.