Ionic + Account kit phone number = crash on android - ionic-framework

I want to user accountkit on ionic for connection but when i press the button the app is crashing with no errors
Method :
(<any>window).AccountKitPlugin.loginWithPhoneNumber({
useAccessToken: true,
defaultCountryCode: "IN",
facebookNotificationsEnabled: true,
}, data => {
(<any>window).AccountKitPlugin.getAccount(
info => this.userInfo = info,
err => console.log(err));
});
Someone can help me ?

I also get this error today and waste so much time to find a solution for it. But all question has no answer. Finally, I got a solution that is work for me. I post here for someone who need.
Add this line
cordova.system.library.9=com.google.android.gms:play-services-auth:16.0.0
into platforms/android/project.properties
Hope it is useful

Related

Flutter Firebase Authentication with Email Links not working

I'm following this guide, I'm having this code:
var acs = ActionCodeSettings(
url: 'https://example.com/auth/widget',
androidPackageName: 'com.example',
iOSBundleId: 'com.example',
handleCodeInApp: true,
androidInstallApp: true,
androidMinimumVersion: '12',
);
var emailAuth = 'john.doe#pm.me';
FirebaseAuth.instance
.sendSignInLinkToEmail(
email: emailAuth, actionCodeSettings: acs)
.catchError((onError, stackTrace) {})
.then((value) =>
print('Successfully sent email verification'));
Sending the email works, but when I click on the email, then…
in iOS it opens https://example.com/auth/widget - which is the fallback
in Android it shows a circular loader for about 1s and then it "falls down" and nothing happens
The incoming link handler
FirebaseDynamicLinks.instance.onLink.listen((dynamicLinkData) {
print('got dynamic link! $dynamicLinkData');
}).onError((error) {
print('error error!');
});
I configured dynamic links in Firebase to point to to.example.com. I also added a manual dynamic link to.example.com/test which opens my app (the got dynamic link! message shows up) - so all seems fine, the problem seems to lie in the link generation.
The link structure I get by email is:
https://to.example.com/?link=https://example-abcd.firebaseapp.com/__/auth/action?apiKey…%26continueUrl%3Dhttps://example.com/auth/widget%26lang%3Den&apn=com.example&amv=12&ibi=com.example&ifl=https://example-abcd.firebaseapp.com/__/auth/action?apiKey%3D…%26continueUrl%3Dhttps://example.com/auth/widget%26lang%3Den
After some more painful hours of debugging and reading documentation I finally found it out. Most of this is in the flutter documentation, but since the documentation has broken links and is a bit all over the place it was hard for me to catch it all!
Android
I needed to decrease the androidMinimumVersion from 12 to 1. Then my app opens and I can receive the dynamic link. No idea why. My android simulator is android version 13 but the app never opened.
Before decreasing the android version I also set the sha256 setting in firebase, using gradlew signingReport documented in this answer. Not sure though this was required.
iOS
I forgot to do all the steps documented in receiving links on iOS section, namely:
add the dynamic links domain into associated domains
add FirebaseDynamicLinksCustomDomains into Info.plist
Overall, I found that to get this feature working was really really hard for me as a Flutter beginner. But I guess a lot of the setup I can re-use as the dynamic links capability seems to be something which comes in handy in the future.

Deeplink in Ionic V4?

We are using Ionic 4 with lazy loading. My app routing works by app.routing.module.ts file. How to use deep link to open app from external link like email or sms?
It seems you didn't type this into Google first so this question is likely going to be closed shortly.
Ionic provide a deep linking library:
https://ionicframework.com/docs/native/deeplinks
It's used like this:
this.deeplinks.routeWithNavController(this.navController, {
'/about-us': AboutPage,
'/products/:productId': ProductPage
}).subscribe(match => {
// match.$route - the route we matched, which is the matched entry from the arguments to route()
// match.$args - the args passed in the link
// match.$link - the full link data
console.log('Successfully matched route', match);
}, nomatch => {
// nomatch.$link - the full link data
console.error('Got a deeplink that didn\'t match', nomatch);
});
You are supposed to do as much research as you can on your own before you open a question on StackOverflow. People are happy to help but they usually want to see you have tried for yourself as you are just giving your job to somebody else otherwise.

Facebook Instant Games API method canSubscribeBotAsync() always returns false while testing

I am testing an instant games app and I ultimately want my bot to collect messaging_game_plays events to log user data at the end of a play session. To allow messaging_game_plays to be sent, I've been directed by this answer to canSubscribeBotAsync(), and subscribeBotAsync() from the Facebook Instant Games API v6.2. Following the API reference as a guide, I've built these canSubscribeBotAsync and subscribeBotAsync methods into the game's startup sequence. I also have my fbapp-config.json set up with the proper
{
"instant_games": {
"bot": {
"subscription_type": "OPT_IN_DEV"
},
...
}
}
The problem I am facing is that canSubscribeBotAsync() always returns false when I test the application and so I can't test the behavior when it returns true. canSubscribeBotAsync() doesn't seem to return any other information when it returns false so I'm not exactly sure what is causing it to return this way.
I'm currently testing this problem by building and uploading my game to the facebook app, then moving it to the testing stage. Then I've been playing this game from my facebook account.
My question is: is there either some way to know why canSubscribtBotAsync() returns false when it does? or does there exist a setting on my facebook app or personal facebook profile that might cause canSubscribeBotAsync() to always return false?
I did note in the documentation for this method that any given player would only be prompted once. I haven't ever seen the opt-in prompt, but is there a chance the have-you-seen-it-already-flag has been tripped and it's returning false because of that?
I've had someone else try with their own account with the same behavior. I'm just now testing out some more possibilities, but I figured I would post this now in case anything looks out of place right away to anyone. I'm not expecting to find anything revolutionary, but I'll keep this question updated if I find anything else.
[edit] Tried with one more new facebook account and was able to see the logs of the game for a first time run. It gave a message to the user saying that the app would like to access public profile data and canSubscribeBotAsync() returned false before the user clicked accept on the data prompt. After clicking "OK", the application resumed as usual.
The loading sequence:
Here is code I'm running with // rest of game setup logic in place for the setup logic for a Phaser 3 game.
window.onload = () => {
console.log('FB Instant Games SDK Version: ' + FBInstant.getSDKVersion());
FBInstant.initializeAsync().then((value: boolean) => {
FBInstant.player.canSubscribeBotAsync().then((can_subscribe: boolean) => {
console.log((can_subscribe ? 'can' : 'cannot') + ' subscribe player to bot');
if (can_subscribe) {
FBInstant.player.subscribeBotAsync().then(function () {
console.log('subscribed player to bot');
}).catch(function (e: any) {
console.log('didn\'t subscribe player to bot. error: ' + e.message);
})
}
}).catch(function (e: any) {
console.log('couln\'t check if player can be subscribed. error: ' + e.message);
});
// rest of game setup logic
});
};
I always get the following output amidst the rest of the application output:
FB Instant Games SDK Version: 6.2
cannot subscribe player to bot <--(canSubscribeBotAsync returning false)
I have tried a number of different arrangements for the starting sequence, but I might not have this set up correctly?
This question looks to have a very similar problem, but the thread ends without a solution.
If anyone has any ideas or any bits of documentation that would point me in the right direction that would be greatly appreciated! I've done a fair bit of browsing myself but I've probably missed something along the way.
This is already above in a comment but I'll put it here as it was the solution to my problem!
It turned out that I was calling canSubscribeBotAsync before startGameAsync. Here is the order of calls that ended up working for me. This successfully prompted the user to opt in to bot messaging:
window.onload = () => {
FBInstant.initializeAsync().then((value: boolean) => {
FBInstant.startGameAsync().then(function () {
FBInstant.player.canSubscribeBotAsync().then((can_subscribe: boolean) => {
if (can_subscribe) {
FBInstant.player.subscribeBotAsync().then(function () {
// start game here
}).catch(function (e: any) {
// and here regardless
})
}
}).catch(function (e: any) {
// start game here too, launch the game!
});
// or start game here if the game should load underneath the popup
// this ended up not having good flow so we started the game above
});
});
};

Facebook Instant Game IAP error: {code: "UNKNOWN", message: "Product not purchaseable"}

I am developing a game for a client and we are now testing payments / purchasing.
So inside the In-App Purchase set-up page, I've:
1.) added a Dev account to the Testers list
2.) Created a product
My code looks like this:
let supportedAPIs:any = FBInstant.getSupportedAPIs();
if(supportedAPIs.includes('payments.purchaseAsync'))
{
console.log('payments supported...');
FBInstant.payments.onReady(() => {
console.log('payments ready...');
FBInstant.payments.purchaseAsync({
productID: 'my_temp_prod'
}).then((purchase) => {
console.log(purchase);
}).catch((err) => {
console.log(err);
});
});
}
I tried to run it on Android and it showed me this once:
After clicking "OK", it did not show any payment dialog, and I could never get a payment dialog to appear on Android.
I then tried to test it on the desktop browser version and the code simply results in a {code: "UNKNOWN", message: "Product not purchaseable"} error.
I am still able to see "payments supported" and "payments ready" logged out so I know that at least that part is working, but I cannot get a test dialog to appear.
Are we missing anything? We already have a payment account setup too.
Ok, it turns out you have to use consumePurchaseAsync after a successful purchase. You can also use getPurchasesAsync to check if there are any remaining purchases left that need to be fullfilled.
My bad, I thought purchases for instant games worked liked normal FB games (you didn't have to "consume" products there). For anyone who may be lost, I hope this helps.

Facebook Instant Gaming Matchmaking blocked on "The player is not currently eligible to match."

I have setup the matchmaking code and actually got it working 3 times where it searched, waited, and then found a match (my other account also set to search), without any problems.
Then all of a sudden both of them stopped working with the only message being: The player is not currently eligible to match.
This is the code (pretty generic):
FBInstant.checkCanPlayerMatchAsync().then(function(canMatch) {
console.log("Player can match: ", canMatch);
if (canMatch) {
// ok if we can, let's search //
console.log("searching for match...", tag);
FBInstant.matchPlayerAsync(tag, true).then(function() {
console.log(FBInstant.context.getID());
}).catch(function(err) {
console.log(err);
});
}
}).catch(function(err) {
console.log(err);
});
tag is match_bounty
Does anyone have any idea why this stopped working?
Edit: If I create a new account, with the same code it works correctly.
It appears to be a problem with v6.2 of the Instant Games SDK.
v6.1 works as expected for 3 matches and then its locked again.