Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMAPositioningManager currentRoadElement #47

Open
shial4 opened this issue May 29, 2018 · 0 comments
Open

NMAPositioningManager currentRoadElement #47

shial4 opened this issue May 29, 2018 · 0 comments

Comments

@shial4
Copy link

shial4 commented May 29, 2018

Hi,

I am trying to configure HereMaps for use with out NMAMapView object.
I have implemented few helper methods for that
`

@objc(initializeNMAContext)
class func initializeNMAContext() {
    guard !NMAApplicationContext.isInitialized() && MotionPermissionViewController.isDetermind else { return }
    let context = "NMAContext-Info".readPlist()
    if let appId = context?["appId"] as? String,
    let appCode = context?["appCode"] as? String,
    let licenseKey = context?["licenseKey"] as? String {
        NMAApplicationContext.setAppId(appId, appCode: appCode, licenseKey: licenseKey)
    }
    
    DispatchQueue.main.async {
        NMANavigationManager.sharedInstance().mapTrackingEnabled = true
        NMANavigationManager.sharedInstance().mapTrackingAutoZoomEnabled = true
        NMANavigationManager.sharedInstance().backgroundNavigationEnabled = true
        NMANavigationManager.sharedInstance().backgroundMapTrackingMaximumRefreshRate = 0.2
        NMANavigationManager.sharedInstance().mapTrackingOrientation = .dynamic
        NMANavigationManager.sharedInstance().isSpeedWarningEnabled = true
        
        if let dataSource = NMAHEREPositionSource() {
            NMAPositioningManager.sharedInstance().dataSource = dataSource
            dataSource.setBackgroundUpdatesEnabled(true)
        }
    }
}

@objc(isPositioning)
class func isPositioning() -> Bool {
    return NMAApplicationContext.isInitialized() && NMAPositioningManager.sharedInstance().isActive
}

@objc(startPositioning)
class func startPositioning() {
    guard NMAApplicationContext.isInitialized() else { return }
    if !NMAPositioningManager.sharedInstance().isActive {
        BackgroundTask.run(queue: .main) { task in
            _ = NMAPositioningManager.sharedInstance().startPositioning()
        }
    }
}

@objc(stopPositioning)
class func stopPositioning() {
    guard NMAApplicationContext.isInitialized() else { return }
    NMAPositioningManager.sharedInstance().stopPositioning()
}

`

And I do listen to NMAPositioningManagerDidUpdatePosition notification
However, currentRoadElement is always null in there.

Can you help me with it?
What is the correct use case for background execution with out maps.
No maps I mean:
There is no NMAMapView object
Nothing is displayed on the screen.

(We are talking about realtime use-case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant