Sygic not showing current position nor displaying markers










2















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)
);











share|improve this question
























  • 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















2















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)
);











share|improve this question
























  • 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













2












2








2








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)
);











share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 12:14









Fantômas

32.6k156389




32.6k156389










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

















  • 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












1 Answer
1






active

oldest

votes


















0














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;

);





share|improve this answer























  • 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










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
);



);













draft saved

draft discarded


















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









0














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;

);





share|improve this answer























  • 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















0














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;

);





share|improve this answer























  • 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













0












0








0







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;

);





share|improve this answer













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;

);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 10:25









bio007bio007

13519




13519












  • 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





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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto