Android SDK Installation, need:
- The sdk android. Note that the auto update in HTTP do not do its job. You have to force the HTTPS by allowing download in case of warning (some checkbox in options).
- Eclipse and Android pluggins.
- (optional) A good thinks is to install SVN fo eclipse. SVN works on stand alone mode. It allow you to undo some changes in code in case of bad idea.
When you start the first time the Android Emulator, the emulator take 5 minutes to load.
Look at the the Android demo code. There is seome good examples.
Note that, if you do a game, you should:
- forbid the screen to rotate because it restart your application.To do this you have to edit the manifest.xml. You can test that on emulator by presssing 7 and 9 on num keys.
- lock the screen to have full contrast. You do this on code.
http://www.androidsnippets.org/snippets/53/
private PowerManager.WakeLock wakeLock;
public void onResume() {
this.wakeLock.acquire();
}
public void onPause() {
this.wakeLock.release();
}
- the emulator does not emulate the gravity.
- to project the down gravity (g) on the (X, Y) screen, see the code below. There is maybe an error on the side. It consists to take the accelaration (i.e. the gravity in normal case) vector, and take the angle on the plan (X, Y)
public void
onResume() {
this.sensorManager.registerListener(mSensorListener, sensorManager.getDefaultSensor(Sensor.SensorManager.TYPE_ACCELEROMETER),SENSOR_DELAY_NORMAL);
super.onResume();
}
private final SensorEventListener mSensorListener =new SensorEventListener() {
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
Log.d("Sensor", "onAccuracyChanged");
}
@Override
public void onSensorChanged(SensorEvent event) {
float gX = event.values[SensorManager.DATA_X];
float gY = event.values[SensorManager.DATA_Y];
double gAngus = -90;
if (gX != 0 && gY != 0) {
double exactAngus = Math.atan2(-gY, gX) * 180 / Math.PI;
}
if (view != null) {
view.onOrientationChanged((float) gAngus);//any function
}
}
};
To play sound: SoundManager & SoundPool.
http://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html
Sound collection: http://www.freesound.org/
|