roam-ai / roam-flutter

Flutter Location SDK. High accuracy and battery efficient location SDK for iOS and Android by Roam.ai
https://roam.ai
MIT License
17 stars 5 forks source link

Stream of current user location. #13

Closed jigarfumakiya closed 1 year ago

jigarfumakiya commented 3 years ago

Hello @jothipriyadharshanr

I have flow all the steps adding SDK to flutter. and it working but when I startTracking there are not methods available to track the user's current location. (if there are I did not find them on docs.).

Can you please let me know if there are any methods or streams available for continuous user tracking?

Thanks in advance.

jothipriyadharshanr commented 3 years ago

Hello @jothipriyadharshanr

I have flow all the steps adding SDK to flutter. and it working but when I startTracking there are not methods available to track the user's current location. (if there are I did not find them on docs.).

Can you please let me know if there are any methods or streams available for continuous user tracking?

Thanks in advance.

Hey @jigarfumakiya Thanks for your message.

We do have methods within startTracking which will tracking user location continuously. The link which tells about the different tracking modes are here

You can also try our Example Application here to refer the implementation.

Please let me know if that helped.

jigarfumakiya commented 3 years ago

@jothipriyadharshanr Yes, I have tried your example it crashes at multiple button clicks. (Like start tracking and User Update many other)

About Tracking Yes I have added start tracking methods but where is the callback Here is the code.

 @override
  void initState() {
    // TODO: implement initState
    super.initState();
    Permission.locationAlways.request();

    setupLocation();
  }

Future<void> setupLocation() async {
    await Roam.getUser(
      userId: '611e0dc751efb03cbddb2cc2',
      callBack: ({user}) {
        print(user.toString());
      },
    );

    Roam.getListenerStatus(callBack: ({user}) {
      print('getListenerStatus');
      print(user);
    });

    Roam.getCurrentLocation(accuracy: 20, callBack: ({location}) {
      print('getCurrentLocation');
      print(location);
    },);

    Roam.subscribeUserLocation(userId: '611e0dc751efb03cbddb2cc2');

  }

void myButtonClick(){
    Roam.startTracking(trackingMode: 'active').then((value) {
      print('Tracking Started');
    });
  }

Let me know where I can get the location every time when is changed

jigarfumakiya commented 3 years ago

Kindly reminder @jothipriyadharshanr Any update on this?