Bob
Bob

Reputation: 415

Whats the best way to orchastrate multiple google API clients?

I am new to Java and I think I'm at a little learning curve in my understanding.

I have a project which consists of 3 google API clients in 3 separate files. I would like a way to pull the results of each API into one instance and use the results of one to dynamically change the parameters of another.

for example:

ActivityRecognitionAPI - give me if the device is WALKING, RUNNING etc

GeoFencingAPI - lets me create a geofence around a location...

How would I use the result of walking, to change the size of the geofence?

This is all in the context of an Android app and I'd appreciate any references to things I should read / try.

Upvotes: 0

Views: 45

Answers (1)

OSGI Java
OSGI Java

Reputation: 645

My understanding is that you have multiple clients. You want to call these clients and use results of these calls.

My suggestion to you is to create a class encapsulating these clients:

    class GeoFence{

        private ActivityRecognition activityRecognition;
        private GeoFencing geoFencing;

        public GeoFence(ActivityRecognition activityRecognition, GeoFencing geoFencing) {
            this.activityRecognition = activityRecognition;
            this.geoFencing = geoFencing;
        }
    }

Then add a method representing the action that you want to perform with a pseudo-code describing what you need the method to do:

        public void addGeoFence() {
            // get current activity type (call activityRecognition API)
            // add geo fence given the current activity (call activityRecognition API)
        }

Now, you are ready to implement the method.

Upvotes: 1

Related Questions