Difference between using a service (Angular) and using NativeScript's application-settings - nativescript

I am working on a simple mobile app with Angular and NativeScript. I can't seem to understand the difference between using an Angular service to share information between components and using NativeScript's applications-settings. They both seem to do very similar things.
I started using a service to store information such as userId, username, phoneNumber, name, jobTitle, etc., which get retrieved in most of the components I am using. That is working fine; however, I just discovered that I could do the same with the application-settings module.
When should I use a service and when should I use application-settings? What is the most efficient approach?

Angular Services save data in the application life cycle, it means if you close the app, the data will not exist anymore.
But if you want to save data and use them whenever you want to open the app, you can use application-settings. It's actually a native module. The module uses SharedPreferences on Android and NSUserDefaults on iOS. It's something like localStorage on the web.

Related

LUIS: Edit project downloaded from Azure

I have subscription on Azure and I dowloaded chat bot with my AppId and password. On page luis.ai I trained new model and exported it to downloaded azure project (with flight booking). I replaced their cognitive model with my model from luis.ai, but after that - azure project is always working with old data. I donĀ“t understand why, because their model is removed from my PC. What should I do to working with my own model? Thanks.
You code is based on the core-bot sample. First of all, make sure that your LUIS configuration is set up correctly in your .env file (or in App Settings if running from Azure). The recognizer is created in index.js and passed to MainDialog.js. From the core-bot sample code, I'm actually not seeing where it is importing the local code. I think that is maybe just to give you the model to import to your own LUIS app? If you have the proper LUIS keys and app ID, it should respond to whatever you have in there. My guess is maybe that you replaced the FlightBooking.json LUIS model file, but didn't actually point the bot to your LUIS app with the new intents.
I would suggest, though, that this isn't the best sample to use if you are trying to just tweak it. There are a lot of things here that are set up specifically for booking flights that don't really make sense if that's not what your bot is doing. Personally I like the Dispatch Bot sample better as a starting point (even if you are not using Dispatch CLI tool), though it has the intent actions within the bot file instead of separate dialogs. Maybe that will give you a better starting point though?

Is there any code to manipulate the localstorage with any UWP

Edge DevTools Preview could manipulate local storage of a PWA APP , could i do it also ?
EdgeDevTools is a close source APP , and i googled , no document says some API or SDK could manipulate the localstorage of a PWA APP.
Yes, since the UWP application is a sandbox application, in theory each application is independent of each other and cannot directly access the data of an App.
The PWA application relies on WWAHost.exe, but it also enjoys the treatment of UWP applications. Its data is protected and will not expose data access methods.
Best regards.

How to use AppCenter Analytics on .net Core WebApi backend?

I'm able to send events to appcenter.ms from my XamarinForms App . However, sending the events requires the app secret key to be added to the android/ios app itself. This key can be easily extracted using a decompiler.
On my webapi backend, like the Xamarin app, I tried adding the nuget package and then in Startup.cs
AppCenter.Start("SECTETKEYHERE", typeof(Analytics));
And then tracking the event this way
Analytics.TrackEvent("MyTestEvent",new Dictionary<string, string>{{"EventNameHere","EventValueHere"}});
However, no event data ever arrives in the appcenter dashboard.
So my question is , how do I use the trackevent functionality on the serverside, or , at the very least, store the key on the app side securely(I'd really rather not do this).
My fallback plan is to use google analytics as it works fine .
Thanks

Advantages of using APIs wrapped with .NET in Xamarin

Around a year ago I made an iOS application that finds restaurants near your location of any type and displays information about them. I made a web service call using the FourSquare api to get all the data which was returned in json format and then I parsed it and displayed the information on the UI of the app. Now I want to make an android application using Xamarin.Android since I am learning working with Xamarin studios and C#. When I make a Xamarin.Android application and go to packages then add packages I see there is a Foursquare api package that has a .NET wrapper around it. Here is the website url:
https://www.nuget.org/packages/Foursquare.Api/
So my question is how does this work? Does adding this package mean I don't have to make a web serivce call anymore, instead all the data is stored inside this package and I just have to get all the data the same way I get information from a local database? What are the advantages of using this package instead of just making a web service call to Foursquare?
Think of it this way:
This Foursquare API is simply a .NET wrapper of the web service that you want to use. Thus, somebody has gone ahead and done all of the hard work for you so you can simply consume the returned data in your applications.
What does this mean for you?
Well it means that you don't have to write any REST consumption code and you can focus more on the actual application and any business logic that you need to implement based on the Foursquare objects.
To not confuse any further, this data would come the same way as if you wrote your own web service to access the data from the Foursquare API endpoint.
Advantages:
Already written for you
You don't need to know your way around their REST API
Usually follows best practices per language so it's easy to consume (Objects created, methods, etc)
Disadvantages:
REST endpoint might be updated and not reflect in the package until it's updated
Any bugs/issues in the framework can be hard to workaround if the project is not open source
Could be a lack of documentation on how to use the wrapper

How to grab selected HTML from browser and pull into my app

I'd like to create a Cocoa app that is able to grab selected text from a website in a third-party browser (in other words, NOT from an embedded webkit instance running within my own app) and then store it in my app's database. From what I can tell, I need to user some kind of service for this, like how selected text in Textedit can be turned into a new sticky note via a service. However, I'd like to be able to provide this app through the App Store. Does that mean I need to use XPC services?
That's as far as I have gotten. So if I do need to use XPC services, can someone point me in a helpful direction? The Services Implementation Guide is totally over my head.

Resources