Leveraging mobile features in Android
There are a lot of features that mobile devices have nowadays. In this recipe, we will learn how to take advantage of those features in our app. We will use the accelerometer in an Android app.
Getting ready
We will create an Android package in this recipe. Thus, you should read the recipe Packaging for Android in this chapter. We also will use similar code in this app to that in recipe Working with the accelerometer in Chapter 2, Input, Motion, and Touch. We need the KV file, e2.kv
:
#e2.kv <Acce>: Label: id: label1 pos: 150, 300 text: 'X: ' Label: id: label2 pos: 150, 250 text: 'Y: ' Label: id: label3 pos: 150, 200 text: 'Z: ' Label: id: status pos: 150, 150 text: '' Button: id: button1 pos: 150, 50 text: 'Start' on_press: root.pressed1()
We also need...