Domanda

I want to use an ActivityRecognitionClient and a LocationClient in the same Activity. The trouble is that either calls onConnected.

I would like to use both e.g. to write the location and the recognized activity to a database.

I thought that should be a rather easy thing to do but could not find out how. Hope someone can help.

UPDATE

I use Services now instead of Activities and implement the clients separately, connecting when the service is started and disconnecting when it is destroyed.

È stato utile?

Soluzione

The same activity cannot implement two methods with the same name from different interfaces. This is well explained here Java - Method name collision in interface implementation

You might want to make separate classes implementing each interface separately and call your methods to read/write to your database from both of them.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top