2

I am developing a mobile app around google maps using Ionic4 and native google maps. The problem here is that I am successfully able to see maps being loaded in the browser on system using ionic cordova run browser -l but when I tried to build and run the apk in a device, it gives white scree. I also tried using ionic serve -c and connect to my phone on dev app but see the same white screen and no logs. I am unable to figure out as what is causing it. Any help is greatly appreciated.

My code can be found here. APK can also be found at the same place.

infinite
  • 553
  • 1
  • 15
  • 31

1 Answers1

0

This sounds like google api key credentials issue to me:

https://developers.google.com/maps/documentation/embed/get-api-key

When you on step 5 which is

On the API key page, under Key restrictions, set the Application restrictions.

You ll select Android Apps and add your

package name : com.example

SHA-1 certificate fingerprint: 60:xx:xx:xx:xx:xx:xx:xx:EE:3C:E4:C5:xx:xx:xx:xx:xx:xx:xx:C2 (Something Like this)

How to create SHA-1 is already answered, if you dont know please take a look here

Than give it 5 to 10 min and try again, it should work.

Hope it helps.

Whatatimetobealive
  • 1,175
  • 8
  • 14
  • Thanks Whatatimetobealive, I will look into it and keep you posted. – infinite Dec 25 '18 at 07:42
  • @ Whatatimetobealive, It didn't work. I added package name as `com.example` and added SHA1 1 generated using keystore. No luck. – infinite Dec 26 '18 at 05:54
  • Hmm sounds interesting, did you use your own package name ? you should use your own package name I gave com.example as an example, check your AndroidManifest.xml, there is a package='com.something.app' on the second line use that one. – Whatatimetobealive Dec 26 '18 at 06:01
  • I don't think there is any `AndroidManifest` in `Ionic` ? More over I don't think its the API key as it should have worked without restrictions if that was the case. Now we are restricting to Android app. – infinite Dec 26 '18 at 07:25
  • I mean of course there is, so main problem is google map restriction you have to define where are you going to use google api so if your using on Android device you have to define it. Your package name is should be this one "io.ionic.starter" , if you do terminal command ionic cordova build android you ll see androidmanifest.xml file. How are you creating to APK without androidmanifest.xml I lost you there ? – Whatatimetobealive Dec 26 '18 at 07:38
  • I updated the package name as you suggested `io.ionic.starter`. Its there in `config.xml` but no luck so far. I mean I don't see any manifest file. Not sure where is it located. I referred [link](https://ionicframework.com/docs/v1/guide/publishing.html) to build apk and it got built without any errors. – infinite Dec 26 '18 at 08:12