android:id="@+id/hokuyo_view_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="5dp"
+ android:layout_marginRight="5dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
+import android.net.wifi.WifiManager;
+import android.net.wifi.WifiManager.WifiLock;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
private Sensor mGravity = null;
private SensorEventListener accel = null;
private PowerManager mPowerManager = null;
+ private WifiManager mWifiManager = null;
private WakeLock mWakeLock = null;
+ private WifiLock mWifiLock = null;
private DomainApp appDomain = null;
private HokuyoView hokuyo_view = null;
private MenuItem speed_publ_item = null;
super.onResume();
mWakeLock.acquire();
+ mWifiLock.acquire();
}
@Override
}
mWakeLock.release();
+ mWifiLock.release();
}
@Override
}
}
+ @SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
- mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass().getName());
+ mWakeLock = mPowerManager.newWakeLock(
+ PowerManager.SCREEN_BRIGHT_WAKE_LOCK
+ | PowerManager.ACQUIRE_CAUSES_WAKEUP
+ | PowerManager.ON_AFTER_RELEASE,
+ getClass().getName());
+
+ mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+ mWifiLock = mWifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, getClass().getName());
hokuyo_view = (HokuyoView) findViewById(R.id.hokuyo_view);