I need to display interstitial Google Ads on click of a button. After 3 seconds timeout, I need to close interstitial Google Ads and display routing screen.
I have opened interstitial Google Ads. But I won't be able to close it.
displayAds(page) {
let interstitialConfig: AdMobFreeInterstitialConfig = {
isTesting: true,
autoShow: true
};
this.admob.interstitial.config(interstitialConfig);
this.admob.interstitial.prepare().then(() => {
}).catch(e => alert(e));
}
Related
I'm using Google Play Games service in my unity game and want to silently login my game so that the dialogue popup at the top shows only once.
Right now everytime I open the game that dialogue comes up. like this
And it takes around 5s for the dialog thing to complete that's why I want to do it silently so that user can directly enter to game if they have just signed in.
I've seen in some games that when we opens the game for the very first time only then that dialogue comes and on next further opening the dialogue doesn't comes and we directly enter to the game.
My code is
void Start()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.AddOauthScope("profile")
.RequestServerAuthCode(false)
.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
if (!PlayGamesPlatform.Instance.localUser.authenticated)
{
Debug.Log("We're not authenticated in, let's authenticate first");
PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptOnce,
(code) =>
{
if (code == SignInStatus.Success)
{
Debug.Log("We're not signed in, let's signin first");
/// Signed in! Hooray!
PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
{
ServerAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode(),
CreateAccount = true,
}, OnGoogleLoginSuccess, error =>
{
Debug.Log("Error " + code);
// TODO: Move to splash scene with practice mode only
});
}
else
{
/// Error signing in. We'll want to show a sign in button
}
}); /// <--- That "true" is very important!
}
else
{
Debug.Log("We're already signed in");
}
}
so the main issue is that PlayGamesPlatform.Instance.localUser.authenticated
always returns false.
Thanks!
How can i detect in Ionic Vue if the app closes or if the app is send to the background?
this.platformor platform isn't available or does not work?!
You can subscribe to the appStateChange event, like described here: https://capacitorjs.com/docs/apis/app
Example:
import { App } from '#capacitor/app'
export default {
created () {
App.addListener('appStateChange', state => {
if (!state.isActive) { // if isActive is true, App got sent to foreground, if it is false, it got sent to the background
...
}
})
}
}
I have a button in my ionic application to open a article from the homepage. I want to enable my users to exit the app by pressing the device back button. But when they are at the article page I want it to just go back to the homepage when pressing the back button.
I created a custom backbutton event to handle the function of exiting the app. It can exit the app from the homepage. However when pressing the back button on the article page, it does not navigate back to the homepage and nothing happens. How can I make it goes back to the homepage from the article page when pressing the back button?
In app.component.ts
this.platform.backButton.subscribeWithPriority(99, async () => {
if (this.routerOutlet && this.routerOutlet.canGoBack()) {
this.routerOutlet.pop();
} else if (this.router.url === '/home') {
navigator['app'].exitApp();
}
});
I noticed that this.routerOutlet.canGoBack returns false when firing the event from the article page, so the routerOutlet.pop() is not fired. Not sure if this is to do with how I open the article page?
This is how i open the article page
viewArticle(articleId) {
let navigationExtras: NavigationExtras = {
state: {
articleId: articleId
}
};
this.navController.navigateForward(['/article'], navigationExtras);
}
facebook: ~5.0.1andexpo: 33.0.0`
onFacebookSignIn = async () => {
try {
const {
type,
token,
} = await Facebook.logInWithReadPermissionsAsync(facbookAppId, {
permissions: ['public_profile', 'email'],
browser: 'browser'
});
if (type === 'success') {
const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
Alert.alert('Logged in!', `Hi ${(await response.json()).name}!`);
} else {
console.log('cancel');
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
}
}
**on click of a button it opens facebook login page login via my email and password works fine but in case of login via install facebook app, it takes me to next allow page but than next page show blank:(
i have spent couple of days on this on and off, thankyou.
screen**
Since Facebook actually opens and you are prompt with the login page then it is most probably that you make a mistake setting up your Facebook app on your Facebook developer account.
Follow this to set your Facebook app correctly
Make sure to set host.exp.Exponent for your app field iOS Bundle ID
Make sure to set rRW++LUjmZZ+58EbN5DVhGAnkX4= for your app field Android key hash
Please follow this since you are using expo SDK 33
In ionic framework,clicking back button to close app instead of going back to previous page.It is only happen in android 9.Work fine in other android version.
I already wrote these code in app.component.ts
this.platform.backButton.subscribe(() => {
if (this.router.isActive('/home', true) && this.router.url === '/home') {
navigator['app'].exitApp();
}
});
Here is the solution : in homepage.ts May be work
ionViewDidEnter(){
this.subscription = this.platform.backButton.subscribe(()=>{
navigator['app'].exitApp(); });
}
ionViewWillLeave(){
this.subscription.unsubscribe();
}