Hi,
Can anybody guide me how i can use following code in my app:
<STRONG><SPAN class=""> CODE</SPAN></STRONG> <SPAN class="">Portal</SPAN> { <SPAN class="">id:</SPAN><SPAN class=""> portal</SPAN> <SPAN class="">url</SPAN>: <SPAN class=""><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fwww.arcgis.com" target="_blank">http://www.arcgis.com</A><SPAN>"</SPAN></SPAN> <SPAN class="">onSignInComplete</SPAN>: { <SPAN class="">console</SPAN>.log(qsTr(<SPAN class="">"Signed in!"</SPAN>)); ArcGISRuntime.license.setLicense(portal.portalInfo.licenseInfo) } <SPAN class="">onSignInError</SPAN>: { <SPAN class="">console</SPAN>.log(qsTr(<SPAN class="">"Failed to sign in."</SPAN>)); } } <SPAN class="">function portalSignIn ( ) </SPAN>{ <SPAN class="">// Supply user credentials to login into online Portal</SPAN> portal.credentials.userName = <SPAN class="">"<your username>"</SPAN> portal.credentials.password = <SPAN class="">"<your password>"</SPAN> portal.signIn(); }
<SPAN class="">LicenseInfo</SPAN> { <SPAN class="">id:</SPAN><SPAN class=""> licenseInfo</SPAN>} <SPAN class=""><SPAN class="">function</SPAN> <SPAN class="">setLicense</SPAN> (<SPAN class=""></SPAN>) </SPAN>{ <SPAN class="">// Add code here to fetch the saved license information from local storage</SPAN> <SPAN class="">var</SPAN> loadedString = <SPAN class="">"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) }</SPAN>
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
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.