Closed oferRounds closed 7 years ago
You can safely call Radar.startTracking()
immediately after requesting permissions. Tracking will only start once the user grants permissions, and will not be started if the user has not granted permissions.
export const startTracking = async (cleanerId) => {
Radar.setPlacesProvider('none');
Radar.setUserId(String(cleanerId));
const status = await Radar.getPermissionsStatus();
if (status !== 'GRANTED') {
Radar.requestPermissions(true);
}
Radar.startTracking();
};
The problem in this code, that Radar.startTracking
calls before user give permissions. And of course we can't track user with this code until he will relauch app with given permissions. There is nice to have a callback @nickpatrick Or maybe we can have other solution?
Hi, I also found the lack of a callback in Radar.requestPermissions(background)
(v3.0.6) to be insufficient for my use case.
I resorted to using react-native-permissions which has more fine-tuned options when it comes to checking/requesting permissions and the subsequent callbacks to perform your other business logic. The repo also has great documentation and examples for how to use it.
Hopefully, a combination of react-native-radar
and react-native-permissions
can satisfy your needs. Best of luck!
Thanks, Tony. We're planning to add a callback or remove permissions helpers in favor of this lib (or similar) in the next major release. Appreciate the feedback!
On Wed, Jan 6, 2021 at 9:15 PM Tony Xu notifications@github.com wrote:
Hi, I also found the lack of a callback in Radar.requestPermissions(background) (v3.0.6) to be insufficient for my use case. I resorted to using react-native-permissions https://github.com/zoontek/react-native-permissions which has more fine-tuned options when it comes to checking/requesting permissions. The repo also has great documentation and examples for how to use it. Hopefully, a combination of react-native-radar and react-native-permissions can satisfy your needs. Best of luck!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/radarlabs/react-native-radar/issues/10#issuecomment-755838401, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB33WQ4WMSDUK5MTFM3T73SYUKKXANCNFSM4D5JCFXA .
--
Nick Patrick CEO and Co-Founder nick@radar.io
Hi,
It says that you should can start tracking once the user has granted permission, but how can I tell when it’s done if I don’t have a callback?