Comments (8)
Any update?
from firebase.
still waiting... i might just go back to Flutter
from firebase.
I fixed the issue by changing polyfills.ts file like below,
/**
* NativeScript Polyfills
*/
// // Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame)
// import '@nativescript/core/globals';
// // Install @nativescript/angular specific polyfills
// import '@nativescript/angular/polyfills';
// /**
// * Zone.js and patches
// */
// // Add pre-zone.js patches needed for the NativeScript platform
// import '@nativescript/zone-js/dist/pre-zone-polyfills';
// // Zone JS is required by default for Angular itself
import 'zone.js';
// // Add NativeScript specific Zone JS patches
// import '@nativescript/zone-js';
from firebase.
By changing my polyfills.ts file as you have indicated creates another issue (locally).
Any http service call now gets the following error: TypeError: Cannot read properties of undefined (reading 'call')
Here's the method that I use for my http "Get" calls:
const stream$ = this.get(endpoint, { responseType: type });
let results = lastValueFrom(stream$).then((value: any) => {
return value;
}).catch((error: any) => {
return error;
});
return results;
from firebase.
Since I faced the same situation, I used the Nativescript HTTP module. If you are not sending an ICMP request, you may consider using it. I couldn't find any other solution for now.
https://docs.nativescript.org/http.html#http
from firebase.
I will give it a try and let you know my results. Thank you!
from firebase.
For anyone who is interested, I decided to eliminate the firebase packages and just write my own little service to handle Google Ads.
Currently, I only have Interstitial ads for iOS using the latest version of pod 'Google-Mobile-Ads-SDK' (which is 10.5.0 at this time).
First thing to do, add a Podfile to your App_Resources/iOS folder:
platform :ios, '12.0'
pod 'Google-Mobile-Ads-SDK'
Then create an injectable service to handle the ads:
/******************************************************************************
* Google Admob Interstitial.
******************************************************************************/
import { Injectable } from '@angular/core';
import { isIOS, isAndroid } from "@nativescript/core/platform";
import { getNumber, setNumber } from '@nativescript/core/application-settings';
declare var UIApplication, UISplitViewController, UINavigationController, UITabBarController, GADRequest, GADInterstitialAd;
@Injectable({
providedIn: 'root'
})
export class AdmobService {
private androidBannerId: string = "ca-app-pub-00000/00000";
private androidInterstitialId: string = "ca-app-pub-00000/00000";
private iosBannerId: string = "ca-app-pub-00000/00000";
private iosInterstitialId: string = "ca-app-pub-00000/00000";
private keywords: string[] = ["news", "top news", "politics", "business", "finance", "social media"];
public showAd() {
let adCount = getNumber("_adcount", 0);
if (adCount >= 3) {
adCount = 0;
}
if (adCount === 0) {
if (isIOS) {
this.showIOSAd();
}
}
adCount++;
setNumber("_adcount", adCount);
}
private showIOSAd() {
let request = GADRequest.request();
request.keywords = this.keywords;
GADInterstitialAd.loadWithAdUnitIDRequestCompletionHandler(this.iosInterstitialId, request, (ad: any, error: any) => {
if (!error) {
ad.presentFromRootViewController(topViewController());
}
});
}
}
export const topViewController = () => {
const root = rootViewController();
if (root == null) {
return undefined;
}
return findTopViewController(root);
};
const rootViewController = () => {
const app = UIApplication.sharedApplication;
const window = app.keyWindow || (app.windows.count > 0 && app.windows[0]);
return window != null ? window.rootViewController : undefined;
};
const findTopViewController = (root: any) => {
const presented = root.presentedViewController;
if (presented != null) {
return findTopViewController(presented);
}
if (root instanceof UISplitViewController) {
const last = root.viewControllers.lastObject;
if (last == null) {
return root;
}
return findTopViewController(last);
}
else if (root instanceof UINavigationController) {
const top = root.topViewController;
if (top == null) {
return root;
}
return findTopViewController(top);
}
else if (root instanceof UITabBarController) {
const selected = root.selectedViewController;
if (selected == null) {
return root;
}
return findTopViewController(selected);
}
else {
return root;
}
};
Finally, call the 'showAd()' method from the constructor of the view/page you want to load the ad in:
import { AdmobService } from '~/services/admob.service';
constructor(private admobService: AdmobService) {
this.admobService.showAd();
}
from firebase.
Just published my app to the Apple App Store and downloaded it through TestFlight - works as expected!
from firebase.
Related Issues (20)
- Android `showNotificationsWhenInForeground` not working
- Didn't find class "org.nativescript.plugins.firebase.MyFirebaseMessagingService" HOT 1
- Can't build on new xcode 14.3 HOT 5
- Can't build with xcode 14.2 no such module FirebaseMessaging HOT 7
- Nativescript 7.0.0 failed to build plugin @nativescript/firebase HOT 1
- firebase().ui().show crashes on Android with Error: Cannot read properties of undefined (reading 'launch') HOT 1
- @nativescript/firebase-auth and @nativescript/firebase-ui are incompatible on iOS HOT 3
- 'No APNS token specified' error getting token on iOS HOT 20
- [Android] dlopen failed: library "libNativeScript.so" not found HOT 5
- Android warning on App Check HOT 1
- [iOS][auth] Firebase App Check support for Firebase Authentication (Update firebase authentication to >10.8.0)
- With FirebaseAppDelegateProxyEnabled = false, phone authentication hangs and then crashes HOT 1
- `const admin = require('firebase-admin')` crashes with `TypeError: Cannot read properties of undefined (reading 'env')` HOT 3
- Displaying alert after canceling from firebase().ui().show() causes exception HOT 2
- [firebase-crashlytics] Fatal errors aren't sent to Firebase console HOT 2
- [Firebase-storage][Android] Error: An unknown error occurred, please check the HTTP result code and inner exception for server response. HOT 1
- Migrating from legacy FCM APIs to HTTP v1 HOT 3
- [firebase-crashlytics AND firebase-messaging] iOS app crashes upon launch HOT 6
- Expost remove listeners for firebase messaging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase.