Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Issue in enableLocationRequest #121

Closed
phatakrajan opened this issue Mar 17, 2018 · 2 comments
Closed

Issue in enableLocationRequest #121

phatakrajan opened this issue Mar 17, 2018 · 2 comments
Labels

Comments

@phatakrajan
Copy link

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

  • iOS/Android/Both - Android
  • iOS/Android versions - 7.1
  • emulator or device. What type of device? Device

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it) - 3.4.2
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project) 3.4.1
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project) "tns-android": "3.4.2"
  • Plugin(s): (look for the version numbers in the package.json file of your
    project and paste your dependencies and devDependencies here)
    "dependencies": {
    "@angular/animations": "~5.2.0",
    "@angular/common": "~5.2.0",
    "@angular/compiler": "~5.2.0",
    "@angular/core": "~5.2.0",
    "@angular/forms": "~5.2.0",
    "@angular/http": "~5.2.0",
    "@angular/platform-browser": "~5.2.0",
    "@angular/platform-browser-dynamic": "~5.2.0",
    "@angular/router": "~5.2.0",
    "nativescript-angular": "~5.2.0",
    "nativescript-geolocation": "^4.2.4",
    "nativescript-google-maps-sdk": "^2.5.0",
    "nativescript-plugin-firebase": "^5.1.8",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.5.2",
    "tns-core-modules": "~3.4.0",
    "zone.js": "~0.8.2"
    },
    "devDependencies": {
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "~0.6.0",
    "typescript": "~2.6.2"
    }

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

  1. Created default nativescript agular application.
  2. In items.component.ts, add below function in ngOnInit

geolocation.isEnabled().then(function (isEnabled) {
if (!isEnabled) {
geolocation.enableLocationRequest().then(function () {
}, function (e) {
console.log("!!!Error: " + (e.message || e));
});
}
}, function (e) {
console.log("!!Error: " + (e.message || e));
});
Issue is

JS: ERROR Error: Uncaught (in promise): Error: Cannot enable the location service. TypeError: com.google.android.gms.location.LocationRequest is not a constructor

Here is my observation.
When enableLocationRequest() function is called, it pops up permission dialog. However promise returns with error in background with error
Error: [object Object]
On Approving the permissions I get below issue
JS: ERROR Error: Uncaught (in promise): Error: Cannot enable the location service. TypeError: com.google.android.gms.location.LocationRequest is not a constructor
JS: Error: Cannot enable the location service. TypeError: com.google.android.gms.location.LocationRequest is not a constructor
JS: at file:///data/data/com.nativescr.adsample/files/app/tns_modules/nativescript-geolocation/geolocation.js:187:28 [angular]
JS: at Object.onInvoke (file:///data/data/com.nativescr.adsample/files/app/tns_modules/@angular/core/bundles/core.umd.js:4787:33) [angular]
JS: at Object.onInvokeTask (file:///data/data/com.nativescr.adsample/files/app/tns_modules/@angular/core/bundles/core.umd.js:4778:33) [angular]
Executing after-watch hook from C:\Rajan\NativeScript\AdMobSample\hooks\after-watch\nativescript-dev-typescript.js
Executing after-watch hook from C:\Rajan\NativeScript\AdMobSample\hooks\after-watch\nativescript-dev-typescript.js

Is there any code involved?

  • provide a code example to recreate the problem
  • (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.
    Code provided above in ngOnInit
@DimitarTachev
Copy link
Contributor

Hi @phatakrajan,

This is a known issue related to the NativeScript app build. Try removing your platforms folder and making a clean app build as described in this issue comment. You could also track the issue progress there.

@phatakrajan
Copy link
Author

This worked @DimitarTachev . I later saw those comments and followed comments. Application started working

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants