How to enable the RealisticView events in HERE iOS Premium SDK 3.18+ - here-api

Using the HERE iOS Premium SDK 3.18 to create a routing App and I can't figure out what is needed in order to enable the Realistic View events in order to get signpost data for maneuvers in the route.
I have specified the NavigationManager Delegate and created functions for the event callbacks. When I create a route and run a simulation on the route, I never receive either of the realistic view events. I have scoured the User Guide and the API Reference but can't get the events.
func navigationManager(_ navigationManager: NMANavigationManager, didUpdateRealisticViewsForNextManeuver realisticViews: [NSNumber : [String : NMAImage]]) {
mapState.status = "Realistic View Updated for Next Maneuver!"
}
func navigationManager(_ navigationManager: NMANavigationManager, didUpdateRealisticViewsForCurrentManeuver realisticViews: [NSNumber : [String : NMAImage]]) {
print("RealisticViews: \(realisticViews.count)")
for key in realisticViews.keys {
print("key: \(key)")
}
mapState.status = "Realistic View Updated for Current Maneuver!"
}
======
Update: I located my problem, I was missing the step to register the realisticview aspect ratios after doing that I started receiving the events. From the User Guide:
"The Realistic View feature is disabled by default. To enable it, use NMANavigationManager.realisticViewMode property and set the view mode to NMARealisticViewDay or NMARealisticViewNight. Next, register the desired image aspect ratios by using NMANavigationManager.realisticViewAspectRatios property."

====== Update: I located my problem, I was missing the step to register the realisticview aspect ratios after doing that I started receiving the events. From the User Guide:
"The Realistic View feature is disabled by default. To enable it, use NMANavigationManager.realisticViewMode property and set the view mode to NMARealisticViewDay or NMARealisticViewNight. Next, register the desired image aspect ratios by using NMANavigationManager.realisticViewAspectRatios property."

Related

Nest Device Room(id or displayName) does not get updated in SDM api

I add a device for the first time in Nest app, and I set the 'where' parameter e.g. Backyard, and complete the device add flow.
Now, in my own app, when I hit SDM api to get list of devices, it gives me a parentRelation object in there which tells where my device is assigned.
parentRelation: { parent: 'enterprises/eid/structures/sid/rooms/rid, displayName: Backyard}
But when I update the 'where' parameter inside the Nest app, under device settings to 'Family Room' for example.
This change would not appear in the SDM api. It would still give me the first configuration data when I added the device.
Can anyone help me with this?

How to find which TVs are currently using my app?

I am developing an app for Android TV is it possible to know, on which TV my app is running or what action is performed on it?
Thank you.
To review your app's supported devices:
Sign in to your Play Console.
Select an app.
On the left menu, click
Release management > Device catalog. If you haven't already, review
and accept the Terms of Service.
Select the All, Supported, or
Excluded tabs. If you want to download a list of devices as a CSV
file, near the right side of the page, click Download device list.
For more infos:
https://support.google.com/googleplay/android-developer/answer/7353455
To track action performed on your app, you can use Fabric's Answers plug in.
Here is a sample code you'll need to add in your code to track events in Answers:
public void onKeyMetric() {
// TODO: Use your own string attributes to track common values over time
// TODO: Use your own number attributes to track median value over time
Answers.getInstance().logCustom(new CustomEvent("Video Played")
.putCustomAttribute("Category", "Comedy")
.putCustomAttribute("Length", 350));
}
For more infos:
https://fabric.io/kits/android/answers

Adding a button for google signin using f#/fable/asp.net/react

I'm working with the SAFE stack (https://safe-stack.github.io/) and through the example dojo. It's great so far.
I'd like to extend the example to include a button to login/auth via Google. So I looked at an example on the Google website (https://developers.google.com/identity/sign-in/web/build-button). And then I had a look how to do authentication using ASP.NET (https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?view=aspnetcore-2.1&tabs=aspnetcore2x) As a result I ended up confused as to how to integrate this into a SAFE project. Can someone tell me what they would do? SHould I be trying to use ASP.NET Identity or should I be using the JWT approach? I don't even know if they are the same since I'm very new to web frameworks.....
The other question I have is how would one inject raw Javascript into the client side of a SAFE project. The google example above shows raw JS/CSS/HTML code? Should I be injecting that as is or should I look in React for some button that does this and map that idea back through Fable?
Setting up OAuth
The easiest way to use Google OAuth is to wait until the next release of Saturn, at which point Saturn will include the use_google_oauth feature that I just added. :-) See the source code if you're interested in how it works, though I'm afraid you can't implement this yourself with use_custom_oauth because you'll run into a type error (the underlying ASP.NET code has a GoogleOptions class, and use_custom_oauth wants an OAuthOptions class, and they aren't compatible).
To use it, add the following to your application CE:
use_google_oauth googleClientId googleClientSecret "/oauth_callback_google" []
The last parameter should be a sequence of string * string pairs that represent keys and values: you could use a list of tuples, or a Map passed through Map.toSeq, or whatever. The keys of that sequence are keys in the JSON structure that Google returns for the "get more details about this person" API call, and the values are the claim types that those keys should be mapped to in ASP.NET's claims system. The default mapping that use_google_oauth already does is:
id → ClaimTypes.NameIdentifier
displayName → ClaimTypes.Name
emails[] (see note) → ClaimTypes.Email
Those three are automatically mapped by ASP.NET. I added a fourth mapping:
avatar.url → `"urn:google:avatar:url"
There's no standard ClaimTypes name for this one, so I picked an arbitrary URN. Caution: this feature hasn't been released yet, and it's possible (though unlikely) that this string might change between now and when the feature is released in the next version of Saturn.
With those four claim types mapped automatically, I found that I didn't need to specify any additional claims, so I left the final parameter to use_google_oauth as an empty list in my demo app. But if you want more (say you want to get the user's preferred language to use in your localization) then just add them to that list, e.g.:
use_google_oauth googleClientId googleClientSecret "/oauth_callback_google" ["language", "urn:google:language"]
And then once someone has logged in, look in the User.Claims seq for a claim of type "urn:google:language".
Note re: the emails[] list in the JSON: I haven't tested this with a Google account that has multiple emails, so I don't know how ASP.NET picks an email to put in the ClaimTypes.Email claim. It might just pick the first email in the list, or it might pick the one with a type of account; I just don't know. Some experimentation might be needed.
Also note that third-party OAuth, including GitHub and Google, has been split into a new Saturn.Extensions.Authorization package. It will be released on NuGet at the same time that Saturn's next version (probably 0.7.0) is released.
Making the button
Once you have the use_google_oauth call in your application, create something like the following:
let googleUserIdForRmunn = "106310971773596475579"
let matchUpUsers : HttpHandler = fun next ctx ->
// A real implementation would match up user identities with something stored in a database, not hardcoded in Users.fs like this example
let isRmunn =
ctx.User.Claims |> Seq.exists (fun claim ->
claim.Issuer = "Google" && claim.Type = ClaimTypes.NameIdentifier && claim.Value = googleUserIdForRmunn)
if isRmunn then
printfn "User rmunn is an admin of this demo app, adding admin role to user claims"
ctx.User.AddIdentity(new ClaimsIdentity([Claim(ClaimTypes.Role, "Admin", ClaimValueTypes.String, "MyApplication")]))
next ctx
let loggedIn = pipeline {
requires_authentication (Giraffe.Auth.challenge "Google")
plug matchUpUsers
}
let isAdmin = pipeline {
plug loggedIn
requires_role "Admin" (RequestErrors.forbidden (text "Must be admin"))
}
And now in your scope (NOTE: "scope" will probably be renamed to "router" in Saturn 0.7.0), do something like this:
let loggedInView = scope {
pipe_through loggedIn
get "/" (htmlView Index.layout)
get "/index.html" (redirectTo false "/")
get "/default.html" (redirectTo false "/")
get "/admin" (isAdmin >=> htmlView AdminPage.layout)
}
And finally, let your main router have a URL that passes things to the loggedInView router:
let browserRouter = scope {
not_found_handler (htmlView NotFound.layout) //Use the default 404 webpage
pipe_through browser //Use the default browser pipeline
forward "" defaultView //Use the default view
forward "/members-only" loggedInView
}
Then your login button can just go to the /members-only route and you'll be fine.
Note that if you want multiple OAuth buttons (Google, GitHub, Facebook, etc) you'll probably need to tweak that a bit, but this answer is long enough already. When you get to the point of wanting multiple OAuth buttons, go ahead and ask another question.

Firebase + GTM + GA implementation issue

I am using iOS Swift 3 and trying to track screen views in Firebase and push those data into GA with GTM.
My issue is that I cannot get the screen name from "screen_view" events pushed into GA.
In firebase, the initial automated screen view hit has no screen name and only screen class so I used Analytics.setScreenName to set the screen name and override the screen class.
However this causes two hits in Firebase, one automated with no screen name and one manually triggered with screen name.
Also, I want to pass the screen name from the event into GA as a screen view type. I set the screenName field in GTM to a variable.
I have tried various event parameters for the variable
"firebase_screen" : results in not found and (not set) in GA
"_sn" : results in "invalid event parameter" in xCode debug
So I guess all the parameters that start with _ are reserved in Firebase. So how do I get the reserved event parameters from firebase into GA. For example, I may want to store the App Version in a custom dimension for something.
The biggest problem here is the screen name not picking up in the screenview hit from GTM to GA.
In Google Tag Manager you'll want to set the following:
Tag type: Universal Analytics (Google Analytics)
Track Type: Screen View
Field Name: screenName
Value: [the variable I've identified below]
Trigger: Fire on "Event Name" contains screen
** Note the Trigger might be better as matches "screen_view", but I haven't had a chance to test
Variable:
Variable Type = Event Parameter
Event Type = Custom Parameter
Event Parameter Key = _sn
Other Things
Make sure the Analytics.setScreenName is working and in ViewDidAppear as that fills the _sn parameter.
Xcode Debug Example
In Xcode you should see something such as:
firebase_screen_id (_si) = 4233194112313113131331;
firebase_screen_class (_sc) = ViewController;
firebase_screen (_sn) = Home View;
firebase_realtime (_r) = 1;
firebase_debug (_dbg) = 1;
firebase_event_origin (_o) = auto;

Bosun: Save Information using post url and the get the same information and use it in template

We have a notification which will post data to an application using the application end point.
notification ABC{
post = savedetailsurl
body = {{.|json}}
useBody = true
}
So the end point will save all the details in mysql DB.
Now in our template we call another end point to get the details which we saved using the webhook in notification.
template ABC {
use the " getDetailsUrl" and use the details in forming the email
}
Now the problem is race condition. Sometimes the details are not saved yet in the backend (mysql), and getDetailsUrl is called. So we get the empty result.
Is there are way to solve the race condition.
Bosun's notification system is designed to be very basic. If you want something more advanced you will need to use a separate system to generate the notification details and/or handle the alert workflow. Some people have used pagerduty or other monitoring systems like Shinken to do more advanced notifications or alert management.
Your best bet is to skip the built in notifications and do everything in a external system. You can still use the http://bosun.org/api to integrate with the various alert states (crit/warn/ack/close/etc) or you can change your alerts to use log = true to bypass all the built in states and create your own workflow.

Resources