i am trying to deploy my app from android studio to my phone and see the below error stream indicating internet issue. but that is definitely not correct. as the same code with same connection is working fine on iOS.
2025-03-01 08:18:33.297 11755-11755 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-03-01T14:18:33.295Z] @firebase/firestore: Firestore (9.23.0): PersistentStream close with error: FirebaseError: [code=unavailable]: The operation could not be completed
2025-03-01 08:18:33.302 11755-11755 Capacitor/Console it.moblize.baniya E File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-03-01T14:18:33.299Z] @firebase/firestore: Firestore (9.23.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unavailable]: The operation could not be completed
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
2025-03-01 08:18:33.307 11755-11755 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-03-01T14:18:33.305Z] @firebase/firestore: Firestore (9.23.0): MemoryPersistence Starting transaction: Release target
2025-03-01 08:18:33.314 11755-11755 Capacitor/Console it.moblize.baniya E File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: ERROR Error: Uncaught (in promise): FirebaseError: [code=unavailable]: Failed to get document because the client is offline.
FirebaseError: Failed to get document because the client is offline.
2025-03-01 08:18:33.316 11755-11755 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-03-01T14:18:33.313Z] @firebase/firestore: Firestore (9.23.0): MemoryPersistence Starting transaction: Release target
2025-03-01 08:18:33.318 11755-11755 Capacitor/Console it.moblize.baniya E File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: ERROR Error: Uncaught (in promise): FirebaseError: [code=unavailable]: Failed to get document because the client is offline.
FirebaseError: Failed to get document because the client is offline.
2025-03-01 08:18:33.320 11755-11755 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-03-01T14:18:33.317Z] @firebase/firestore: Firestore (9.23.0): WebChannelConnection Creating RPC 'Listen' stream 0x17d185b3: .firestore.v1.Firestore/Listen/channel {"httpSessionIdParam":"gsessionid","initMessageHeaders":{"X-Goog-Api-Client":"gl-js/ fire/9.23.0","Content-Type":"text/plain","X-Firebase-GMPID":"1:329500481487:web:7157d20dc5123abd4ea4ba"},"messageUrlParams":{"database":"projects/baniya-38d78/databases/(default)"},"sendRawJson":true,"supportsCrossDomainXhr":true,"internalChannelParams":{"forwardChannelRequestTimeoutMs":600000},"forceLongPolling":true,"detectBufferingProxy":false,"xmlHttpFactory":{"l":null,"j":false},"encodeInitMessageHeaders":true}
2025-03-01 08:18:37.232 11755-12003 ProfileInstaller it.moblize.baniya D Installing profile for it.moblize.baniya
202
Based on suggestions here is my code looks like:
imports: [
BrowserModule,
IonicModule.forRoot(
{
mode: 'ios'
}
),
provideFirebaseApp(() => initializeApp(firebaseConfig)),
provideAuth(() => {
if (Capacitor.isNativePlatform()) {
return initializeAuth(getApp(), {
persistence: indexedDBLocalPersistence,
});
} else {
return getAuth();
}
}),
provideFirestore(() => {
return initializeFirestore(getApp(), {
experimentalForceLongPolling: true,
})
}),
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
CurrencyPipe
],
My package.json looks like below:
{
"name": "baniya",
"version": "0.0.1",
"author": "Moblize.it LLC",
"homepage": ";,
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/common": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/fire": "^7.5.0",
"@angular/forms": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"@capacitor-community/apple-sign-in": "^7.0.0",
"@capacitor/android": "7.0.1",
"@capacitor/app": "7.0.0",
"@capacitor/browser": "7.0.0",
"@capacitor/core": "^7.0.1",
"@capacitor/haptics": "7.0.0",
"@capacitor/ios": "7.0.1",
"@capacitor/keyboard": "7.0.0",
"@capacitor/network": "^7.0.0",
"@capacitor/status-bar": "7.0.0",
"@capgo/capacitor-social-login": "^1.2.6",
"@googlemaps/js-api-loader": "^1.16.8",
"@ionic/angular": "^7.0.0",
"chart.js": "^4.3.0",
"chartjs-gauge": "^0.3.0",
"chartjs-plugin-datalabels": "^2.2.0",
"firebase": "^9.22.2",
"ionicons": "^7.0.0",
"moment": "^2.29.4",
"rxjs": "~7.5.0",
"swiper": "^9.3.2",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.0",
"@angular-eslint/builder": "^15.0.0",
"@angular-eslint/eslint-plugin": "^15.0.0",
"@angular-eslint/eslint-plugin-template": "^15.0.0",
"@angular-eslint/schematics": "^15.0.0",
"@angular-eslint/template-parser": "^15.0.0",
"@angular/cli": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@angular/language-service": "^15.0.0",
"@capacitor/assets": "^2.0.4",
"@capacitor/cli": "^7.0.1",
"@ionic/angular-toolkit": "^9.0.0",
"@types/google.maps": "^3.58.1",
"@types/jasmine": "~4.0.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~4.3.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"ts-node": "~8.3.0",
"typescript": "^4.8.4"
},
"description": "Baniya App by Moblize.it LLC"
}