nativescript-google-maps-sdk icon indicating copy to clipboard operation
nativescript-google-maps-sdk copied to clipboard

error TS2307: Cannot find module 'platform'.

Open Cloudxyz opened this issue 6 years ago • 2 comments

Maybe is very simple but i cant make this work, i put this code in the app.module.ts

import * as platform from "platform"; declare var GMSServices: any;

but always give me the error

[19-07-10 16:40:58.282] (CLI) ERROR in src/app/app.module.ts(12,27): error TS2307: Cannot find module 'platform'.

so what i need to install? or where? i already tried many times, regards

Cloudxyz avatar Jul 10 '19 21:07 Cloudxyz

Hi Cloud, I'm facing the same issue. Did you solve it? I think that it's due to an outdated behavior to detect which platform the app is running on.

you can replace it with:

import * as platform from "tns-core-modules/platform";

if (platform.isIOS) { // <--- Here you set the API KEY only when running on ios GMSServices.provideAPIKey(globals.GOOGLE_API_KEY); }

trane77 avatar Mar 17 '20 11:03 trane77

Hi Cloud, I'm facing the same issue. Did you solve it? I think that it's due to an outdated behavior to detect which platform the app is running on.

you can replace it with:

import * as platform from "tns-core-modules/platform";

if (platform.isIOS) { // <--- Here you set the API KEY only when running on ios GMSServices.provideAPIKey(globals.GOOGLE_API_KEY); }

trane77 avatar Mar 17 '20 11:03 trane77