Sygic / sygic-maps-kit-android

Project containing Android libraries separated into modules which are built over Sygic Maps SDK and provide rapid development of apps with Sygic maps solution.
MIT License
22 stars 3 forks source link

Navigation doesn't stop by removing the NavigationFragment #102

Open mohand1993 opened 4 years ago

mohand1993 commented 4 years ago

I've noticed that the Navigation continues running in the background even after the NavigationFragment been removed/destroyed. I tried setting the route to null while removing the fragment, but this didn't work as well.

What's the proper way to completely stop the navigation?

Darxie commented 4 years ago

Hello

What do you mean by continues runnig in the backgroud? If you want to stop the demonstration, just call .stop() on the instance. If you want to stop the navigation, use the NavigationManager's .stopNavigation()

If none of these would help, please let me know. Thank you

mohand1993 commented 4 years ago

The thing is, we are not using the navigation manager directly, i believe it's being used internally in the UI-Kit's NavigationFragment, and since the NavigationFragment is the one starting the navigation, my expectation will be that it stops it as well when no longer needed

Darxie commented 4 years ago

According to this code, the navigation should be stopped once the route is null. We have also tested it and found no problems. Could you please elaborate on what actually happens and what would you like to achieve? Is this happening only with your routing api, or does it happen in this app without changing anything? Thanks

mohand1993 commented 4 years ago

@Darxie I debugged into it and followed the execution path, and yes the line you mentioned is reached and manager.stopNavigation() is being executed, but I keep observing log messages indicating that some service is still running and something keeps being downloaded (see logs below). The issue can also be reproduced using the sample app

D/SYGIC: M 20/06/02 01:18:21 -1193111072 Download OK of 0b in 27ms: https://incidents-test.platform.sygic.com/api/speedcam/inarea?version=2
W/SYGIC: W 20/06/02 01:18:21 -1057451552 Downloading incidents failed with http code: 401, error msg: ''

sygicSdkVersion = '15.0.4'

Darxie commented 4 years ago

Hi, did you read the tutorial on our site? https://www.sygic.com/sk/developers/sygic-maps-sdk/android/getting-started There's a difference between initializing the Sygic engine and the navigation. Firstly, you need to initialize the SygicEngine. Only then you can use it - show a map, use the navigation, download a map. The thing with the UI kit is that the engine seems to be initialized while adding the NavigationFragment - so that everything can work properly. After that, it's not necessary to deinitialize the SDK so I guess that it's not handled by the UI kit. So what you see is not the navigation, but is the engine doing the usual. You can deinitialize the sdk by destroying the SygicContext.

mohand1993 commented 4 years ago

Yes I had a look at the SDK documentation, so i tried now simply initializing the SDK and enabling OnlineMapStreaming without starting any UI Component, the sdk seems to be initialized successfully and nothing happens afterwards (see logs below), but after starting the navigation fragment and ending it, the logs i mentioned earlier starts being logged indicating that some speedcam download operation is running

2020-06-02 14:49:20.291 22649-22682 D/SYGIC: M 20/06/02 07:49:20 -977104416 Platform: android, OS: 10, App id: asfinag.sdk.early.tt, SDK version: 15.0.4
2020-06-02 14:49:20.291 22649-22682 D/SYGIC: M 20/06/02 07:49:20 -977104416 CPU: , Cores: 4, Speed(Mhz): 0, Little endian: yes
2020-06-02 14:49:20.291 22649-22682 D/SYGIC: M 20/06/02 07:49:20 -977104416 Build(production): CI: 2019-11-04T13:23:39Z,97,e10aabd2506a930b2966dc956a9510b4ae45f4c6
2020-06-02 14:49:20.454 22649-22682 I/SYGIC: I 20/06/02 07:49:20 -977104416 Online auth status changed: StatusCreatingSession
2020-06-02 14:49:20.484 22649-22682 I/SYGIC: I 20/06/02 07:49:20 -977104416 Online auth status changed: StatusConnected
2020-06-02 14:49:21.018 22649-22700 D/SYGIC: M 20/06/02 07:49:21 -1036860960 Download OK of 0b in 499ms: https://licensing-api.sygic.com/sdk-license-file-service/v1/license-file
2020-06-02 14:49:21.038 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Map licenses status: offline=Licensed, online=Licensed
2020-06-02 14:49:21.067 22649-22700 D/SYGIC: M 20/06/02 07:49:21 -1036860960 Download OK of 0b in 29ms: https://licensing-api.sygic.com/online-maps-service/v1/online-maps
2020-06-02 14:49:21.184 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Entering single thread mode, locking executors: [OnlineMapCacheImpl, Online executor, Core TP, ]
2020-06-02 14:49:21.271 22649-22699 D/SYGIC: M 20/06/02 07:49:21 -1035775520 Download OK of 4984832b in 784ms: https://cdn-osc.sygic.com/offlinespeedcams/v2/offlinespeedcams.sqlite
2020-06-02 14:49:21.428 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Leaving single thread mode, unlocking executors: [Online executor, Core TP, OnlineMapCacheImpl, ]
2020-06-02 14:49:21.431 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Loaded maps: [abw,1],[afg,1],[ago,1],[aia,1],[alb,1],[and,1],[are,1],[arg,1],[arm,1],[ata,1],[atf,1],[atg,1],[aus,1],[aut,1],[aze,1],[bdi,1],[bel,1],[ben,1],[bes,1],[bfa,1],[bgd,1],[bgr,1],[bhr,1],[bhs,1],[bih,1],[blm,1],[blr,1],[blz,1],[bmu,1],[bol,1],[bra,1],[brb,1],[brn,1],[btn,1],[bvt,1],[bwa,1],[caf,1],[can,1],[cck,1],[che,1],[chl,1],[civ,1],[cmr,1],[cod,1],[cog,1],[cok,1],[col,1],[com,1],[cpv,1],[cri,1],[cub,1],[cuw,1],[cym,1],[cyp,1],[cze,1],[deu,1],[dji,1],[dma,1],[dnk,1],[dom,1],[dza,1],[ecu,1],[egy,1],[eri,1],[esp,1],[est,1],[eth,1],[fin,1],[fji,1],[flk,1],[fra,1],[fro,1],[fsm,1],[gab,1],[gbr,1],[geo,1],[gha,1],[gib,1],[gin,1],[glp,1],[gmb,1],[gnb,1],[gnq,1],[grc,1],[grd,1],[grl,1],[gtm,1],[guf,1],[guy,1],[hkg,1],[hmd,1],[hnd,1],[hrv,1],[hti,1],[hun,1],[idn,1],[ind,1],[iot,1],[irl,1],[irn,1],[irq,1],[isl,1],[isr,1],[ita,1],[jam,1],[jor,1],[jpn,1],[kaz,1],[ken,1],[kgz,1],[khm,1],[kir,1],[kna,1],[kor,1],[kwt,1],[lao,1],[lbn,1],[lbr,1],[lby,1],[lca,1],[lie,1],[lka,1],[lso,1],[ltu,1],[lux,1],[lva,1],[mac,1],[maf,1],[mar,1],[mco,1],[mda,1],[mdg,1],[mdv,1],[mex,1],[mhl,1],[mkd,1],[mli,1],[mlt,1],[mmr,1],[mne,1],[mng,1],[moz,1],[mrt,1],[msr,1],[mtq,1],[mus,1],[mwi,1],[mys,1],[myt,1],[nam,1],[ncl,1],[ner,1],[nfk,1],[nga,1],[nic,1],[niu,1],[nld,1],[nor,1],[npl,1],[nru,1],[nzl,1],[oin,1],[omn,1],[pak,1],[pan,1],[pcn,1],[per,1],[phl,1],[plw,1],[png,1],[pol,1],[prk,1],[prt,1],[pry,1],[pse,1],[pyf,1],[qat,1],[reu,1],[rou,1],[rus,1],[rwa,1],[sau,1],[sdn,1],[sen,1],[sgp,1],[sgs,1],[shn,1],[slb,1],[sle,1],[slv,1],[smr,1],[som,1],[spm,1],[srb,1],[ssd,1],[stp,1],[sur,1],[svk,1],[svn,1],[swe,1],[swz,1],[sxm,1],[syc,1],[syr,1],[tca,1],[tcd,1],[tgo,1],[tha,1],[tjk,1],[tkl,1],[tkm,1],[tls,1],[ton,1],[tto,1],[tun,1],[tur,1],[tuv,1],[twn,1],[tza,1],[uak,1],[ual,1],[uar,1],[uaz,1],[uca,1],[uco,1],[uct,1],[udc,1],[ude,1],[ufl,1],[uga,1],[ugg,1],[ugu,1],[uhi,1],[uia,1],[uid,1],[uil,1],[uin,1],[ukr,1],[uks,1],[uky,1],[ula,1],[uma,1],[umd,1],[ume,1],[umi,1],[umn,1],[umo,1],[ums,1],[umt,1],[unc,1],[und,1],[une,1],[unh,1],[unj,1],[unm,1],[unv,1],[uny,1],[uoh,1],[uok,1],[uor,1],[upa,1],[upr,1],[uri,1],[ury,1],[usc,1],[usd,1],[utn,1],[utx,1],[uut,1],[uva,1],[uvi,1],[uvt,1],[uwa,1],[uwi,1],[uwv,1],[uwy,1],[uzb,1],[vat,1],[vct,1],[ven,1],[vgb,1],[vnm,1],[vut,1],[wcl,1],[wlf,1],[wsm,1],[xcp,1],[yem,1],[zaf,1],[zmb,1],[zwe,1],
2020-06-02 14:49:21.471 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Entering single thread mode, locking executors: [OnlineMapCacheImpl, Online executor, Core TP, ]
2020-06-02 14:49:21.473 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Leaving single thread mode, unlocking executors: [Online executor, Core TP, OnlineMapCacheImpl, ]
2020-06-02 14:49:21.473 22649-22682 I/SYGIC: I 20/06/02 07:49:21 -977104416 Loaded maps: empty
Darxie commented 4 years ago

Hi, Please excuse my late reply.

The offline speedcam database is now downloaded by default, however we plan to make this up to the user in the future.

Thank you for your understanding.

pszankat commented 2 years ago

I've used shutdownNavigation() method in onDestroy() method on SygicFragmentSupportV4() fragment for stop the navigation. I hope this will help.