Does it make sense to use the same programming methodology in androids as in java programming?

I want to make an Android application that has sensors, sensors can be hardware sensors or software sensors that are sometimes available on a device, such as an accelerometer, and sometimes I have to do it myself.

Usually, when I have something that controls something (a sensor), I have a service that works in the background.

I want to do something that allows you to create and add new sensors easily and modularly. Can I make an interface that defines the specific methods that all sensors should have, and then create an abstract class that extends the service and implements the i interface defined earlier? Like this:

public interface Sensors{

    public abstract Object getSensorData();
}

public abstract class SensorType extends Service implements Sensors{

    public abstract Object getSensorData(){
        //implementation
    }
}

: strutural , , java, , Android , ? , , .....

+3
1

. Android SensorManager .

, , , .

+2

All Articles