Sygic not showing current position nor displaying markers
i want to show the location indicator when the map is loaded and add a marker whenever the map is clicked but none of these seem to work !
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MapFragment mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment);
assert mapFragment != null;
mapFragment.getMapAsync(new OnMapInitListener()
@Override
public void onMapReady(MapView mapView)
OnlineManager.getInstance().enableOnlineMapStreaming(true);
PositionManager.getInstance().startPositionUpdating();
PositionManager.getInstance().enableRemotePositioningService();
mpView=mapView;
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(new GeoCoordinates(PositionManager.getInstance().getLastKnownPosition().getLongitudeAccuracy(),PositionManager.getInstance().getLastKnownPosition().getLatitudeAccuracy()));
mpView.addMapObject(marker);
return true;
);
@Override
public void onMapError(int error, String info)
);
android maps sygic-mobile-sdk
add a comment |
i want to show the location indicator when the map is loaded and add a marker whenever the map is clicked but none of these seem to work !
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MapFragment mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment);
assert mapFragment != null;
mapFragment.getMapAsync(new OnMapInitListener()
@Override
public void onMapReady(MapView mapView)
OnlineManager.getInstance().enableOnlineMapStreaming(true);
PositionManager.getInstance().startPositionUpdating();
PositionManager.getInstance().enableRemotePositioningService();
mpView=mapView;
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(new GeoCoordinates(PositionManager.getInstance().getLastKnownPosition().getLongitudeAccuracy(),PositionManager.getInstance().getLastKnownPosition().getLatitudeAccuracy()));
mpView.addMapObject(marker);
return true;
);
@Override
public void onMapError(int error, String info)
);
android maps sygic-mobile-sdk
refer this link stackoverflow.com/questions/17143129/…
– Android Team
Nov 14 '18 at 9:00
thanks but the link refers to google maps , which is irrelevant to what i have specified as map context (Sygic-mobile-sdk)
– Mohamed amine Chahed
Nov 14 '18 at 9:20
add a comment |
i want to show the location indicator when the map is loaded and add a marker whenever the map is clicked but none of these seem to work !
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MapFragment mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment);
assert mapFragment != null;
mapFragment.getMapAsync(new OnMapInitListener()
@Override
public void onMapReady(MapView mapView)
OnlineManager.getInstance().enableOnlineMapStreaming(true);
PositionManager.getInstance().startPositionUpdating();
PositionManager.getInstance().enableRemotePositioningService();
mpView=mapView;
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(new GeoCoordinates(PositionManager.getInstance().getLastKnownPosition().getLongitudeAccuracy(),PositionManager.getInstance().getLastKnownPosition().getLatitudeAccuracy()));
mpView.addMapObject(marker);
return true;
);
@Override
public void onMapError(int error, String info)
);
android maps sygic-mobile-sdk
i want to show the location indicator when the map is loaded and add a marker whenever the map is clicked but none of these seem to work !
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MapFragment mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment);
assert mapFragment != null;
mapFragment.getMapAsync(new OnMapInitListener()
@Override
public void onMapReady(MapView mapView)
OnlineManager.getInstance().enableOnlineMapStreaming(true);
PositionManager.getInstance().startPositionUpdating();
PositionManager.getInstance().enableRemotePositioningService();
mpView=mapView;
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(new GeoCoordinates(PositionManager.getInstance().getLastKnownPosition().getLongitudeAccuracy(),PositionManager.getInstance().getLastKnownPosition().getLatitudeAccuracy()));
mpView.addMapObject(marker);
return true;
);
@Override
public void onMapError(int error, String info)
);
android maps sygic-mobile-sdk
android maps sygic-mobile-sdk
edited Nov 14 '18 at 12:14
Fantômas
32.7k156390
32.7k156390
asked Nov 14 '18 at 8:52
Mohamed amine ChahedMohamed amine Chahed
132
132
refer this link stackoverflow.com/questions/17143129/…
– Android Team
Nov 14 '18 at 9:00
thanks but the link refers to google maps , which is irrelevant to what i have specified as map context (Sygic-mobile-sdk)
– Mohamed amine Chahed
Nov 14 '18 at 9:20
add a comment |
refer this link stackoverflow.com/questions/17143129/…
– Android Team
Nov 14 '18 at 9:00
thanks but the link refers to google maps , which is irrelevant to what i have specified as map context (Sygic-mobile-sdk)
– Mohamed amine Chahed
Nov 14 '18 at 9:20
refer this link stackoverflow.com/questions/17143129/…
– Android Team
Nov 14 '18 at 9:00
refer this link stackoverflow.com/questions/17143129/…
– Android Team
Nov 14 '18 at 9:00
thanks but the link refers to google maps , which is irrelevant to what i have specified as map context (Sygic-mobile-sdk)
– Mohamed amine Chahed
Nov 14 '18 at 9:20
thanks but the link refers to google maps , which is irrelevant to what i have specified as map context (Sygic-mobile-sdk)
– Mohamed amine Chahed
Nov 14 '18 at 9:20
add a comment |
1 Answer
1
active
oldest
votes
You’re trying to create new Marker with getLongitudeAccuracy()
and getLatitudeAccuracy()
. You need to use geo coordinates!
If you want to add the marker to the position of last known gps signal you can use this code:MapMarker marker = new MapMarker(PositionManager.getInstance().getLastKnownPosition().getCoordinates())
But as there can be no known position at that time it can result in no marker added. So be sure you have location turned on and strong signal. Based on your example it would make more sense to add marker to the position you clicked on. For that purpose use this code:
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(mpView.geoCoordinatesFromPoint(e.getX(), e.getY()));
mpView.addMapObject(marker);
return true;
);
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
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%2f53296203%2fsygic-not-showing-current-position-nor-displaying-markers%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
You’re trying to create new Marker with getLongitudeAccuracy()
and getLatitudeAccuracy()
. You need to use geo coordinates!
If you want to add the marker to the position of last known gps signal you can use this code:MapMarker marker = new MapMarker(PositionManager.getInstance().getLastKnownPosition().getCoordinates())
But as there can be no known position at that time it can result in no marker added. So be sure you have location turned on and strong signal. Based on your example it would make more sense to add marker to the position you clicked on. For that purpose use this code:
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(mpView.geoCoordinatesFromPoint(e.getX(), e.getY()));
mpView.addMapObject(marker);
return true;
);
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
add a comment |
You’re trying to create new Marker with getLongitudeAccuracy()
and getLatitudeAccuracy()
. You need to use geo coordinates!
If you want to add the marker to the position of last known gps signal you can use this code:MapMarker marker = new MapMarker(PositionManager.getInstance().getLastKnownPosition().getCoordinates())
But as there can be no known position at that time it can result in no marker added. So be sure you have location turned on and strong signal. Based on your example it would make more sense to add marker to the position you clicked on. For that purpose use this code:
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(mpView.geoCoordinatesFromPoint(e.getX(), e.getY()));
mpView.addMapObject(marker);
return true;
);
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
add a comment |
You’re trying to create new Marker with getLongitudeAccuracy()
and getLatitudeAccuracy()
. You need to use geo coordinates!
If you want to add the marker to the position of last known gps signal you can use this code:MapMarker marker = new MapMarker(PositionManager.getInstance().getLastKnownPosition().getCoordinates())
But as there can be no known position at that time it can result in no marker added. So be sure you have location turned on and strong signal. Based on your example it would make more sense to add marker to the position you clicked on. For that purpose use this code:
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(mpView.geoCoordinatesFromPoint(e.getX(), e.getY()));
mpView.addMapObject(marker);
return true;
);
You’re trying to create new Marker with getLongitudeAccuracy()
and getLatitudeAccuracy()
. You need to use geo coordinates!
If you want to add the marker to the position of last known gps signal you can use this code:MapMarker marker = new MapMarker(PositionManager.getInstance().getLastKnownPosition().getCoordinates())
But as there can be no known position at that time it can result in no marker added. So be sure you have location turned on and strong signal. Based on your example it would make more sense to add marker to the position you clicked on. For that purpose use this code:
mpView.addMapGestureListener(new MapGestureAdapter()
@Override
public boolean onMapClicked(final MotionEvent e, final boolean isTwoFingers)
MapMarker marker = new MapMarker(mpView.geoCoordinatesFromPoint(e.getX(), e.getY()));
mpView.addMapObject(marker);
return true;
);
answered Nov 16 '18 at 10:25
bio007bio007
14519
14519
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
add a comment |
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
thanks i was able to resolve it a while ago and the thing is simply i was missing a permission
– Mohamed amine Chahed
Nov 28 '18 at 14:59
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%2f53296203%2fsygic-not-showing-current-position-nor-displaying-markers%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
refer this link stackoverflow.com/questions/17143129/…
– Android Team
Nov 14 '18 at 9:00
thanks but the link refers to google maps , which is irrelevant to what i have specified as map context (Sygic-mobile-sdk)
– Mohamed amine Chahed
Nov 14 '18 at 9:20