capacitor-google-navigation 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -490,6 +490,27 @@ The Android Navigation SDK validates the API key from `AndroidManifest.xml`. Ens
490
490
  **iOS — "This app has attempted to access privacy-sensitive data"**
491
491
  Add both `NSLocationWhenInUseUsageDescription` and `NSLocationAlwaysAndWhenInUseUsageDescription` to `Info.plist` before calling `initialize()`.
492
492
 
493
+ **iOS — App crashes with "Invalid parameter not satisfying: CLClientIsBackgroundable"**
494
+ The Navigation SDK requires background location capability to track position during guidance. In Xcode:
495
+ 1. Select your app target → **Signing & Capabilities** → **+ Capability** → **Background Modes**
496
+ 2. Check **Location updates**
497
+
498
+ Also ensure all three keys are present in `Info.plist`:
499
+ ```xml
500
+ <key>NSLocationWhenInUseUsageDescription</key>
501
+ <string>This app uses your location for navigation.</string>
502
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
503
+ <string>This app uses your location for navigation, including in the background.</string>
504
+ <key>NSLocationAlwaysUsageDescription</key>
505
+ <string>This app uses your location for navigation, including in the background.</string>
506
+ ```
507
+
508
+ **iOS — "This application has been blocked by the Google Navigation SDK"**
509
+ The Navigation SDK requires explicit enrollment — it is not available to all Google Cloud projects by default. Ensure:
510
+ 1. The **Navigation SDK for iOS** is enabled under APIs & Services → Library in Google Cloud Console
511
+ 2. Your project has been granted access (you may need to request it via the [Navigation SDK get started page](https://developers.google.com/maps/documentation/navigation/ios-sdk/get-started))
512
+ 3. Billing is active on the project
513
+
493
514
  **CocoaPods not found / pod install fails**
494
515
  Make sure CocoaPods is installed (`sudo gem install cocoapods`) and run `npx cap sync` before `pod install`.
495
516
 
@@ -15,6 +15,7 @@ import GoogleNavigation
15
15
 
16
16
  func initialize(apiKey: String, completion: @escaping (Bool, String?) -> Void) {
17
17
  DispatchQueue.main.async {
18
+ print("[GoogleNavigation] provideAPIKey called, key length: \(apiKey.count), prefix: \(String(apiKey.prefix(8)))...")
18
19
  GMSServices.provideAPIKey(apiKey)
19
20
  completion(true, nil)
20
21
  }
@@ -17,26 +17,28 @@ class NavigationMapViewController: UIViewController {
17
17
  }
18
18
 
19
19
  override func loadView() {
20
+ let container = UIView(frame: UIScreen.main.bounds)
21
+
20
22
  let options = GMSMapViewOptions()
21
- options.frame = UIScreen.main.bounds
23
+ options.frame = container.bounds
22
24
  let mapView = GMSMapView(options: options)
25
+ mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
26
+ container.addSubview(mapView)
23
27
  self.mapView = mapView
24
- self.view = mapView
25
- }
26
28
 
27
- override func viewDidLoad() {
28
- super.viewDidLoad()
29
-
30
- guard let mapView = mapView else { return }
31
- let enabled = mapView.enableNavigation(with: session)
32
- if enabled {
33
- mapView.cameraMode = .following
34
- }
35
-
36
- addCloseButton()
37
- }
29
+ // Overlay sits above the map and all Google-rendered UI
30
+ let overlay = UIView()
31
+ overlay.translatesAutoresizingMaskIntoConstraints = false
32
+ overlay.isUserInteractionEnabled = true
33
+ overlay.backgroundColor = .clear
34
+ container.addSubview(overlay)
35
+ NSLayoutConstraint.activate([
36
+ overlay.topAnchor.constraint(equalTo: container.topAnchor),
37
+ overlay.bottomAnchor.constraint(equalTo: container.bottomAnchor),
38
+ overlay.leadingAnchor.constraint(equalTo: container.leadingAnchor),
39
+ overlay.trailingAnchor.constraint(equalTo: container.trailingAnchor),
40
+ ])
38
41
 
39
- private func addCloseButton() {
40
42
  let button = UIButton(type: .system)
41
43
  button.setImage(UIImage(systemName: "xmark"), for: .normal)
42
44
  button.tintColor = .white
@@ -44,14 +46,24 @@ class NavigationMapViewController: UIViewController {
44
46
  button.layer.cornerRadius = 20
45
47
  button.translatesAutoresizingMaskIntoConstraints = false
46
48
  button.addTarget(self, action: #selector(closeTapped), for: .touchUpInside)
47
- view.addSubview(button)
48
-
49
+ overlay.addSubview(button)
49
50
  NSLayoutConstraint.activate([
50
- button.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16),
51
- button.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16),
51
+ button.topAnchor.constraint(equalTo: overlay.safeAreaLayoutGuide.topAnchor, constant: 16),
52
+ button.leadingAnchor.constraint(equalTo: overlay.leadingAnchor, constant: 16),
52
53
  button.widthAnchor.constraint(equalToConstant: 40),
53
- button.heightAnchor.constraint(equalToConstant: 40)
54
+ button.heightAnchor.constraint(equalToConstant: 40),
54
55
  ])
56
+
57
+ self.view = container
58
+ }
59
+
60
+ override func viewDidLoad() {
61
+ super.viewDidLoad()
62
+ guard let mapView = mapView else { return }
63
+ let enabled = mapView.enableNavigation(with: session)
64
+ if enabled {
65
+ mapView.cameraMode = .following
66
+ }
55
67
  }
56
68
 
57
69
  @objc private func closeTapped() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-google-navigation",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Google maps turn by turn navigation for capcitor",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",