Archive for category Android

Using the Accelerometer in Android

To help a buddy (r4sh44t) I’ve compiled some code pieces of how using the orientation (accelerometer) in Android. Just in case someone finds it useful.

Global variables that will be useful:

//Justo despues de la declaracion del activity (public class MICLASE extends Activity{ ) podemos declarar estas variables globales
//Just after the declaration of the activity (public class MYCLASS extends Activity{ ) we can declare these global variables
private SensorManager myManager;
private List sensors;
private Sensor oriSensor;
private float oldA;
private float oldP;
private float oldR;

Capturing the sensor:

//Capturar sensor de orientacion (en el onCreate!)
//Capture orientation sensor (in the onCreate!)
myManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
sensors = myManager.getSensorList(Sensor.TYPE_ORIENTATION);
if(sensors.size() > 0)
{
oriSensor = sensors.get(0);
Toast.makeText(getApplicationContext(), "Sensor OK",
2).show();
}
else Toast.makeText(getApplicationContext(), "No Sensor", 2).show();
myManager.registerListener(mySensorListener, oriSensor,
SensorManager.SENSOR_DELAY_GAME);

Reading from the sensor:

//Leer del sensor
//Reading from the sensor
private final SensorEventListener mySensorListener = new SensorEventListener()
{
public void onSensorChanged(SensorEvent event)
{

//Aqui la funcion que usara los datos del sensor
//Here the function that will use the sensor data
yourFunctionThatUsesTheData(event.values[0],
event.values[1],
event.values[2]);;
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
};

Using the data:

//Ejemplo de una funcion que use los datos, solo teniendo en cuenta el cambio desde la ultima vez que se leyó
//Example of a function that uses the data only using the difference of movement from the last read
private void yourFunctionThatUsesTheData (float a, float p, float r){
float thisA = a - oldA * 10;
float thisP = p - oldP * 10;
float thisR = r - oldR * 10;
oldA = a;
oldP = p;
oldR = r;

//Hacer cosas con estas variables
//Do stuff with these variables
}

And to understand what a p & r mean here you have a graphic:

Tags: , , , , , , , , , ,

Android 2.2 FRF85B OTA official! (for Nexus One)

Via soyandroide (spanish) I’ve discovered that there is a new (again) version of Android 2.2 with compilation code FRF85B (lol) for the Nexus One.

In the official nexus one blog you can find the news about this one being de official OTA and that its starting to get onto the Nexus Ones around the world.

Here you have a little summary of what updates have been going:
From Android 2.1 (ERE27) to Android 2.2 (FRF50): Link (44MB~)
From Android 2.2 (FRF50) to Android 2.2 (FRF83): Link (1,8MB~)
From Android 2.2 (FRF83) to Android 2.2 (FRF85B): Link (0,5MB~)
Update: From Android 2.2(FRF85b) to Android 2.2 (FRF91): Link (0,91MB~)
(All the “Link”s are uploaded to megaupload, being the official versions, the official download are between () in the version (the ones that are not broken)).

Here you can find the highlights of Android 2.2 changes http://developer.android.com/sdk/android-2.2-highlights.html.

I’ve just installed the last update, if I feel something new, I’ll post about it :)
By the way, installing all these updates didn’t delete any data of my phone (no apps, no personal data) the only thing I needed to do was reinstall Swype so it gets registered again.

Tags: , , , , , , ,

Kindle in Android!

Its here! I’ve just downloaded it, but I won’t be trying it until tomorrow :)

Amazon launching!


Market Qrcode!

Via: Alt1040

Update: I’ve been trying the app and after registering in Amazon and finding my first book to try (a free book about different ways of cooking eggs haha) I’ve experienced how you can access to the book almost instantly and the reading interface its very clean and easy to use even for a little screen. Here you have some screenshots:
Read the rest of this entry »

Tags: ,

Public Beta of Rockplayer for Android

From soyandroide (spanish) some time ago I discovered Rockplayer, a vídeo player for Android that promises a lot, now, via them again I’ve discovered they are in Public Beta!

Read the rest of this entry »

Tags: , , , , , , , ,

Android 2.2 Froyo on the Nexus One!

I own a Nexus One (given to me from Google in their Android talk in the MWC of this year!) and I was tempted to update my SO from Android 2.1 to 2.2 because I have the need to share my 3G connection via wifi (and flash support is fun to try).

To update my SO I’ve followed the steps from phandroid:

For NON ROOT
1.Download the Android 2.2 firmware for the Nexus
2.Rename the file update.zip and copy it to your microSD card via USB. [Note: make sure the file is named update.zip and not update.zip.zip.]
3.Power down your Nexus One
4.Hold down the “Volume Down” button as you power the phone back on.
5.A screen should appear showing your phone’s system searching for various files. Scroll down to “recovery” and press the “Power” button.
6.When you see the triangle with an exclamation point symbol, press the “Power” and “Volume Up” buttons at the same time.
7.From the menu that appears, select “Apply sdcard:update.zip.”
8.When the screen displays “Install from sdcard complete” select “reboot system now” and wait for the phone to power back up.
There you go! You now have Android 2.2 on your Nexus One, not to mention a faster device, automatic upgrading of apps, a “comments” tab on Android Market and a bunch more.

Oh! And my opinion after upgrading:
Great! Everything goes a little more smooth, there are some little improvements in the interface, the 3G – wifi stuff works nicely and the flash support, sometimes a bit slow, works :)

Update: There is a newer version of Froyo, build FRF83 that seems to be the official release one!
I couldn’t wait and I’ve installed it using the same process above. I got to it via elandroidelibre (spanish) once again! You can download this version from here (official) (1,8mb). It needs to be installed over FRF50 (the one above).
I just noticed that now you can turn your mobile to the “other side” than normally apps got into landscape mode and it gets to the correct landscape mode too (I think this wasn’t like that before, correct me if I’m wrong).

Tags: , , , , , , ,