Is this the right procedure for sharing location between 2 users?
1) Get user's A and User's B location using Location Services API.
2) Upload User's A and user's B location to a database everytime their location changes.
3) On a specified time-interval - retrieve user's A and user's B to user's B and user's A phones respectively (So that each user has the other user's location).
4) Display the location(longitude, latitude, etc) of the users on the screen.
Or, there is a more efficient way? instead of using time intervals, maybe on-change get location from the database? Or not using database at all? I am finding it hard to even start with a strategy to do that, please point me somewhere to get started
add a comment |
1) Get user's A and User's B location using Location Services API.
2) Upload User's A and user's B location to a database everytime their location changes.
3) On a specified time-interval - retrieve user's A and user's B to user's B and user's A phones respectively (So that each user has the other user's location).
4) Display the location(longitude, latitude, etc) of the users on the screen.
Or, there is a more efficient way? instead of using time intervals, maybe on-change get location from the database? Or not using database at all? I am finding it hard to even start with a strategy to do that, please point me somewhere to get started
add a comment |
1) Get user's A and User's B location using Location Services API.
2) Upload User's A and user's B location to a database everytime their location changes.
3) On a specified time-interval - retrieve user's A and user's B to user's B and user's A phones respectively (So that each user has the other user's location).
4) Display the location(longitude, latitude, etc) of the users on the screen.
Or, there is a more efficient way? instead of using time intervals, maybe on-change get location from the database? Or not using database at all? I am finding it hard to even start with a strategy to do that, please point me somewhere to get started
1) Get user's A and User's B location using Location Services API.
2) Upload User's A and user's B location to a database everytime their location changes.
3) On a specified time-interval - retrieve user's A and user's B to user's B and user's A phones respectively (So that each user has the other user's location).
4) Display the location(longitude, latitude, etc) of the users on the screen.
Or, there is a more efficient way? instead of using time intervals, maybe on-change get location from the database? Or not using database at all? I am finding it hard to even start with a strategy to do that, please point me somewhere to get started
asked Nov 14 '18 at 14:24
user9644796
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It depends on what do you want in database. If this is only need I would use Firebase as you can use it as realtime database, so any change will come to both users.
If this "location share" needs to be temporary you can create node in firebase db for it, for example userId -> location -> userLat, userLng. Push location updates to the user's location node. Subscribe to another user's node and listen for changes. After the location share is done you can delete the node to clear unneeded data.
More about firebase: https://firebase.google.com/docs/database/
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302428%2fis-this-the-right-procedure-for-sharing-location-between-2-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It depends on what do you want in database. If this is only need I would use Firebase as you can use it as realtime database, so any change will come to both users.
If this "location share" needs to be temporary you can create node in firebase db for it, for example userId -> location -> userLat, userLng. Push location updates to the user's location node. Subscribe to another user's node and listen for changes. After the location share is done you can delete the node to clear unneeded data.
More about firebase: https://firebase.google.com/docs/database/
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
add a comment |
It depends on what do you want in database. If this is only need I would use Firebase as you can use it as realtime database, so any change will come to both users.
If this "location share" needs to be temporary you can create node in firebase db for it, for example userId -> location -> userLat, userLng. Push location updates to the user's location node. Subscribe to another user's node and listen for changes. After the location share is done you can delete the node to clear unneeded data.
More about firebase: https://firebase.google.com/docs/database/
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
add a comment |
It depends on what do you want in database. If this is only need I would use Firebase as you can use it as realtime database, so any change will come to both users.
If this "location share" needs to be temporary you can create node in firebase db for it, for example userId -> location -> userLat, userLng. Push location updates to the user's location node. Subscribe to another user's node and listen for changes. After the location share is done you can delete the node to clear unneeded data.
More about firebase: https://firebase.google.com/docs/database/
It depends on what do you want in database. If this is only need I would use Firebase as you can use it as realtime database, so any change will come to both users.
If this "location share" needs to be temporary you can create node in firebase db for it, for example userId -> location -> userLat, userLng. Push location updates to the user's location node. Subscribe to another user's node and listen for changes. After the location share is done you can delete the node to clear unneeded data.
More about firebase: https://firebase.google.com/docs/database/
answered Nov 14 '18 at 14:45
Janusz HainJanusz Hain
254211
254211
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
add a comment |
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
I just looked at it, so you say I can have a node for a unique userId which will be replaced every time user location changes? so that I won't have endless nodes for same user, right? I mean, every time user moves, it only replaces the userLat, userLng for that specific node? or it deletes the old node and makes a new one?
– user9644796
Nov 14 '18 at 15:25
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
@pileup userLat, userLng are replaced. So you have only one userLat and userLng per user
– Janusz Hain
Nov 16 '18 at 7:03
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
In general - if you have value (not node) it will get replaced every time you send value. But if it is your node (it is not the lastest value, so it is treated like node) you can have more nodes as those are not replaced - you can have more of them. For your cause you need values, not nodes, and those will be replaced. But if you will need something like finding nearby users you can use nodes and some lat-lng sectors and push userIds into the sectors, this way you don't have to search and compare range to every other user. We got algorithm for it, if you will need it msg me ;)
– Janusz Hain
Nov 16 '18 at 7:41
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302428%2fis-this-the-right-procedure-for-sharing-location-between-2-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown