ionic-team / ionic-starter-maps

An Ionic starter project using Google Maps and a side menu
144 stars 58 forks source link

Map does not show in device (works with browser) #10

Closed italomaia closed 9 years ago

italomaia commented 9 years ago

I created a new project with the maps template. When I run it with ionic (ionic serve), I'm able to see the map in my browser. Running the project in my device or emulator, after installing the platform, (ionic run android or ionic emulate android) the map does not load and I get a blank screen. What could be causing this?

kmarrero commented 9 years ago

add google maps to your whitelist

On Fri, Jun 26, 2015 at 1:20 PM, Italo Maia notifications@github.com wrote:

I created a new project with the maps template. When I run it with ionic (ionic serve), I'm able to see the map in my browser. Running the project in my device or emulator, after installing the platform, (ionic run android or ionic emulate android) the map does not load and I get a blank screen. What could be causing this?

— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-starter-maps/issues/10.

italomaia commented 9 years ago

I have this in config.xml:

<access origin="*"/>
<allow-navigation href="*" />

And I have this in my index.html:

 <meta http-equiv="Content-Security-Policy" content="default-src 'self' *"/>

Shouldn't it be enough?

kmarrero commented 9 years ago

I had to put

.

The map did not show up with alone.

On Fri, Jun 26, 2015 at 2:23 PM, Italo Maia notifications@github.com wrote:

I have this in config.xml:

And I have this in my index.html:

Shouldn't it be enough?

— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-starter-maps/issues/10#issuecomment-115868662 .

italomaia commented 9 years ago
<access origin="http://maps.google.com" />

Was it enough for you? I had a go and map still does not show in the device. Made a repo with my code. Could you take a look? https://github.com/italomaia/mymaps It is but a newly created project with the maps template where I added the new access rule to config.xml. I used "ionic run android" to test it on my device.

kmarrero commented 9 years ago

I tried this and it worked:

  1. ionic start mymap maps
  2. cd mymap
  3. cordova platform add android
  4. cordova build android

The map showed up without adding more to the whitelist than *. I seem to have less issues with cordova builds. This assumes you installed cordova. I typically only use ionic commands to get the starter files then switch commands to cordova. I am using cordova 5.1.1.

On Fri, Jun 26, 2015 at 1:20 PM, Italo Maia notifications@github.com wrote:

I created a new project with the maps template. When I run it with ionic (ionic serve), I'm able to see the map in my browser. Running the project in my device or emulator, after installing the platform, (ionic run android or ionic emulate android) the map does not load and I get a blank screen. What could be causing this?

— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-starter-maps/issues/10.

italomaia commented 9 years ago

It worked! The problem was using ionic command line tool all along = ( Thanks kmarrero! Now I can sleep well again.

franzisk commented 8 years ago

Same problem here, I have in my config.xml:

And I run: cordova build android cordova run android

The map is not showing in this device but in another one with Android 5.0 is showing OK, this one has Android 4.x.x

hunkim commented 8 years ago

Any solution? I got the same problem. It works i web browser, but not in the android/ios.

kmarrero commented 8 years ago

I added to my android manifest

My map had fatal error until I added this.

and to the config file

On Mon, Feb 8, 2016 at 2:42 AM, Sung Kim notifications@github.com wrote:

Any solution? I got the same problem. It works i web browser, but not in the android/ios.

— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-starter-maps/issues/10#issuecomment-181277122 .

usamanoman commented 7 years ago

Same problem....!

kmarrero commented 7 years ago

Did you add this:

android manifest

config file

On Tue, Jan 31, 2017 at 7:38 AM, Usama Noman notifications@github.com wrote:

Same problem....!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic-starter-maps/issues/10#issuecomment-276379866, or mute the thread https://github.com/notifications/unsubscribe-auth/AEoXHCebwMWQE29k58IFT4qnbXbOT-v6ks5rX0dKgaJpZM4FM7Yl .

errorstudent commented 7 years ago

Hi, i have same problem, but my problem solved when i'm try to remove platform and then added again.

$ionic platform rm android
$ionic platform add android

it's work for me!

Neseek77 commented 5 years ago

Adding just this

<allow-navigation href="*" />

in my app's config.xml file solved this problem for me...

gsanjeevkumar commented 5 years ago

everything like you all said, is allowed however the maps do not load on the Android simulator and same on phones all text and HTML is flowing in the app right, navigation works, data from external server (JSON) is coming thru. but no images and no google maps. let me know if you guys have any ideas.