Sub Activity_Create(FirstTime As Boolean)
Dim NativeMe As JavaObject
NativeMe.InitializeContext
NativeMe.RunMethod("turnGPSOn", Null)
End Sub
#If JAVA
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
public void turnGPSOn()
{
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
this.sendBroadcast(intent);
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if(!provider.contains("gps")){ //if gps is disabled
final Intent poke = new Intent();
poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
poke.setData(Uri.parse("3"));
this.sendBroadcast(poke);
}
}
#End IF