mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-04 00:13:20 +08:00
More changes to the namespaces
This commit is contained in:
parent
ceb2dd61c2
commit
b75fdf8610
@ -1,16 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.android.droidgap"
|
package="com.nitobi.droidgap"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0.0">
|
android:versionName="1.0.0">
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_GPS" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||||
|
android:debuggable="true">
|
||||||
<activity android:name=".DroidGap"
|
<activity android:name=".DroidGap"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -4,13 +4,17 @@ import android.content.Context;
|
|||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
|
import android.location.LocationListener;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.util.Log;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
public class PhoneGap {
|
public class PhoneGap{
|
||||||
|
|
||||||
|
private static final String LOG_TAG = "PhoneGap";
|
||||||
/*
|
/*
|
||||||
* UUID, version and availability
|
* UUID, version and availability
|
||||||
*/
|
*/
|
||||||
@ -19,14 +23,17 @@ public class PhoneGap {
|
|||||||
private Context mCtx;
|
private Context mCtx;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private WebView mAppView;
|
private WebView mAppView;
|
||||||
|
private GpsListener mGps;
|
||||||
|
private NetworkListener mNetwork;
|
||||||
|
|
||||||
public PhoneGap(Context ctx, Handler handler, WebView appView) {
|
public PhoneGap(Context ctx, Handler handler, WebView appView) {
|
||||||
this.mCtx = ctx;
|
this.mCtx = ctx;
|
||||||
this.mHandler = handler;
|
this.mHandler = handler;
|
||||||
this.mAppView = appView;
|
this.mAppView = appView;
|
||||||
|
mGps = new GpsListener(ctx);
|
||||||
|
mNetwork = new NetworkListener(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateAccel(){
|
public void updateAccel(){
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -60,14 +67,13 @@ public class PhoneGap {
|
|||||||
public void getLocation(final String provider){
|
public void getLocation(final String provider){
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
LocationManager locMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE);
|
|
||||||
GeoTuple geoloc = new GeoTuple();
|
GeoTuple geoloc = new GeoTuple();
|
||||||
if (locMan.isProviderEnabled(provider))
|
Location loc = mGps.hasLocation() ? mGps.getLocation() : mNetwork.getLocation();
|
||||||
|
if (loc != null)
|
||||||
{
|
{
|
||||||
Location myLoc = (Location) locMan.getLastKnownLocation(provider);
|
geoloc.lat = loc.getLatitude();
|
||||||
geoloc.lat = myLoc.getLatitude();
|
geoloc.lng = loc.getLongitude();
|
||||||
geoloc.lng = myLoc.getLongitude();
|
geoloc.ele = loc.getAltitude();
|
||||||
geoloc.ele = myLoc.getAltitude();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -104,4 +110,6 @@ public class PhoneGap {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user