简体   繁体   中英

Domain whitelist for PhoneGap/Android app w/Google Maps

I'm building a PhoneGap app, targeted for Android now, using Google Maps. If I only whitelist maps.googleapis.com, it doesn't work. The events object isn't there. If I whitelist all domains, it works.

I'd rather not allow access to all domains. What domains other than maps.googleapis.com do I need to allow access to?

The syntax depends on which version of PhoneGap you are using. See the relevant version of the documentation for details - eg. http://docs.phonegap.com/en/3.1.0/guide_appdev_whitelist_index.md.html

For version 3.1 or greater, the following works for me:

<access origin="*://*.googleapis.com/*" subdomains="true" />
<access origin="*://*.gstatic.com/*" subdomains="true" />
<access origin="*://*.google.com/*" subdomains="true" />
<access origin="*://*.googleusercontent.com/*" subdomains="true" />

According to this answer, you need to whitelist:

  • *.google.com
  • *.googleapis.com
  • *.gstatic.com

Notice that answer was over a year old now so some of the domains might be outdated or missing. This should get you started though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM