[Google Maps Mobile] apikey

[Google Maps Mobile] apikey

  
Forge Component
(13)
Published on 11 Oct by Labs
13 votes
Published on 11 Oct by Labs

How to set the apikey outside the OnInitialize. Because i only can get the apikey from local storage

Hello Filipe,


The first step is create a Site Properties called ApiKey, and set you ApiKey Google Maps in this Site Properties.



The second step you can create public action with output parameter ApiKey:

To finish, assign the ApiKey:

I think that this solution is a best practice to solve your problem.


Have a nice day :)

Rodolfo Póvoa Leal

I think you didnt understand. I am not asking how to get the apikey, i have the action. I just want to know a way of calling this action outside the oninitialize

Filipe Lourenço wrote:

I think you didnt understand. I am not asking how to get the apikey, i have the action. I just want to know a way of calling this action outside the oninitialize

I'm sorry Filipe, i thought i had not done that step yet. If you do not want to call the action that returns ApiKey in  OnInitialize, for some functional requirement, you call it when you need to load the map and call the Maps API.

If the answer is not what you expected, please explain in more detail why you need do call this acation outside on OnInitialize.


Best regards

R.P


The map is to be shown initially but loading the apikey in the oninitialize will do a server call and against best practices

Solution

Filipe,

Use a data fetch from local storage - this way you can also block UI rendering until the data is retrieved using an if statement.

You can set up synchronization logic to retrieve this property from the server only every once in a while and save it into local storage. This seems like a pretty good option to me. 

--
Grayson

Solution