Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Include google api key manually

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Include google api key manually

    Hi.

    I have AA v4.2 (ver 12.4.2, Build 3670, SysAdm bld 4684).
    That version is good enough for me for the basic things I use in AA.

    Now, I wanted to see how the google map markers work and somehow (for testing purposes) got around the "Geolocation error : Permission to use GeoLocation Service denied by user" error, that I couldn't solve under chrome, firefox and egde. I understand it requires https/ssl domain, and I only have IP "domain" from my windows vps server container.
    Anyway, I'm able to get the device's Latitude and Longitude shown on the old IE and opera browsers.

    The second problem arises when trying to show the Latitude and Longitude on the map, the browser displaying "This can't load Google Maps correctly", development mode etc.
    I believe this is because I haven't entered the google maps js api key. I have the key for other purposes but in this AA version I don't have the option to enter the key available.

    In the projects Run-time Properties -> Javascript Libraries , the options jump from "Include Google JSAPI libraries" (checkmark) to "Cordova/PhoneGap libraries". No place to do "Google Maps API key".

    My question is can I somehow through a code specify in the project/component the google api key I have? Maybe somewhere in the starting javascript code?
    I could see the following line in the generated source code:
    A5.map._fn='http://maps.googleapis.com/maps/api/js?sensor=true&libraries=geometry&callback=A5.map.init'; ,
    where I was hoping to include the apy key. But I don't have a clue whether (and where) I can insert that program line.

    Or checkboxing Google JSAPI libraries can help out with that?

    Thanks,
    Sime

  • #2
    Re: Include google api key manually

    Not sure you can with the AA Google Map component as I think the script tags for google are automatically generated by AA. If you have access to the Html header you can try adding it there to see if it works.
    2020-01-30_21-59-07.png
    If you have a simple A5W webpage you can likely render the map directly via the Google Javascript API as per
    https://developers.google.com/maps/d...cript/tutorial
    Last edited by mumfie; 01-30-2020, 06:01 PM.
    https://appsbydesign.co.uk/

    Comment


    • #3
      Re: Include google api key manually

      mumfie, thanks for the reply!

      You're right, I can try to put the lines:
      -------------
      </script>
      <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
      async defer></script>
      -------------
      in the main index.a5w .

      I don't know if that will "propagate" the api key to the rest of the subpages that render on a fly, and multiple times - will check and let you know.

      Thanks again!

      Comment


      • #4
        Re: Include google api key manually

        Plus, I think the api key should be defined behind the scenes - not in the main page where anyone can view the source and see it. I'm not sure, will test it when I get a chance.

        Comment


        • #5
          Re: Include google api key manually

          also I am pretty sure you will need to be using an ssl on the server...
          NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

          Comment


          • #6
            Re: Include google api key manually

            Originally posted by CharlesParker View Post
            also I am pretty sure you will need to be using an ssl on the server...
            Thanks Charles.

            Yes, I get the "Geolocation error : Permission to use GeoLocation Service denied by user" because the page is not on the ssl certified server.
            The major and newer browsers don't let you get the Lati/Long due to that requirement, as soon as I click on "Get Lati/Long" button to run that Geolocation function. Unrelated to Google map at that moment (comes up later on). PS I can get the coordinates in IE v11 or the android's Opera, that don't seem to have the ssl condition.

            The google api key issue prevents the google map to be shown.

            Comment


            • #7
              Re: Include google api key manually

              Originally posted by simeatan View Post
              Plus, I think the api key should be defined behind the scenes - not in the main page where anyone can view the source and see it. I'm not sure, will test it when I get a chance.
              Not sure you can prevent the API code being disclosed using javascript API but you can restrict its use to your domain within the google maps admin
              https://appsbydesign.co.uk/

              Comment


              • #8
                Re: Include google api key manually

                Originally posted by mumfie View Post
                Not sure you can prevent the API code being disclosed using javascript API but you can restrict its use to your domain within the google maps admin
                You're right - that restriction will take care of the key being used at multiple domains. I have used the google api key from foxpro before, not even thinking of any domains. And I assume things have changed with the google maps, addresses and apis anyway. Need to apply for another key.
                As a side note, does that that domain need to have the DNS name, an ssl one .... I mean the key gets restricted to http://www.abcdef.com , https://www.abcdef.com , http://12.34.123.234 and/or https://12.34.123.234 ?

                Comment


                • #9
                  Re: Include google api key manually

                  mumfie and Charles, just a quick update: the trick with specifying the key in the Header worked. Previously getting a google api key and removing any restrictions, for now (I couldn't do the restriction to the alpha server's IP web server address, by adding that one only. The client's side IPs seem to be blocked in that case, when testing.)

                  In a meantime I found this in the ReleaseNotes. Haven't tested the txt file.

                  Thanks for your help! I know I'd need to jump to the new version(s) but, although plenty of new goodies, I saw the prices have changed dramatically since Aug '2016. Not willing to spend to much for a playing software.



                  -----------------------

                  UX and Grid Components - Google Maps - API Key - Google has made a change to Google Maps and they now require you to specify an API key when using the Google Maps Javascript API. This release allows you to specify your API key. There are three different ways in which you can specify the API key - described below.

                  NOTE: To obtain your Google Maps you will need to visit the Google site. Do a Google search for 'Google Maps API key'. You will need an API key for Google Maps Javascript API.

                  You can specify the Google Maps API key as follows:

                  When you add a Map control to a UX or Grid there is a new property called Google Maps API key where you can set the key for just the selected Map control
                  You can open the Project Properties dialog when the Web Control Panel has focus and specify the API key in the Project Properties dialog. If you specify the API key here, it will apply to all Map controls (in both the UX and Grid) defined in the current project. It will not be necessary to specify the API key in the properties each Map control. However, if you do specify an API key at the individual Map control level, that key will be used in preference to the key specified in Project Properties.
                  You can create a file called GoogleMapsAPIkey.txt in the executable folder of the Alpha Anywhere Development version that contains the API key. This key will be used for all Map controls in both UX and Grid components if you don't specify the key at the individual Map control level, or in the Project Properties.
                  NOTE: If your Developer version of Alpha Anywhere is installed in the "Program Files (x86)" folder you will need Administrator privileges in order to create the GoogleMapsAPIkey.txt file.

                  ---------------------------------------------------------

                  Comment

                  Working...
                  X