Hi,
Can anybody guide me how i can use following code in my app:
CODE Portal { id: portal url: "http://www.arcgis.com" onSignInComplete: { console.log(qsTr("Signed in!")); ArcGISRuntime.license.setLicense(portal.portalInfo.licenseInfo) } onSignInError: { console.log(qsTr("Failed to sign in.")); } } function portalSignIn ( ) { // Supply user credentials to login into online Portal portal.credentials.userName = "<your username>" portal.credentials.password = "<your password>" portal.signIn(); }
LicenseInfo { id: licenseInfo} function setLicense () { // Add code here to fetch the saved license information from local storage var loadedString = "string fetched from local storage” // Set content of loaded string to be licenceInfo object licenseInfo.json = JSON.parse(loadedString) // Apply license ArcGISRuntime.license.setLicense(licenseInfo) }
Regards,
Muhammad Afzal
Please take a look at our Local Geocode sample which demonstrates how to license your app with the Standard ArcGIS Runtime license.
Recommended way is to license your app at the "App" level before you make calls to the ArcGIS Runtime objects
Component.onCompleted: {
//ArcGISRuntime.license.setLicense("enter your licence string here to be able run this sample in player or as standalone app. Without this, the app can be run in AppStudio only in developer mode.");
logLicenseLevel();
localLocator = ArcGISRuntime.createObject("LocalLocator", {path: copyLocalData()});
console.log(localLocator.json)
}
function logLicenseLevel() {
if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelBasic) {
console.log("basic")
licenceLevel.text = "Basic"
} else if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelStandard) {
console.log("standard")
licenceLevel.text = "standard"
} else if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelDeveloper) {
console.log("developer")
licenceLevel.text = "developer"
}
Hope this helps.
Nakul