OneTrust flutter sdk only works on android - android

i'm trying to integrate the OneTrust sdk in my flutter app, but on ios devices doesn't work.
I'm using the following package:
https://pub.dev/packages/onetrust_publishers_native_cmp/versions/6.25.0
As mentioned in the documentation of the package, the package installed version is the same version in the OneTrust template published through the dashboard on OneTrust site, then I add this line in my Podfile platform :ios, '11.0'.
This is the init function
Future<void> initOneTrust(bool mounted) async {
bool status = false;
log("Init onetrust start");
try {
//Params are not required
final String domainIdentifier = Platform.isAndroid
? OneTrustConfig.domainIdentifierAndroid
: OneTrustConfig.domainIdentifierIos;
// Map<String, String> params = {"countryCode": 'IT', "regionCode": 'IT'};
status = await OTPublishersNativeSDK.startSDK(
storageLocation,
domainIdentifier, // Dynamic identifier
// 'dec6b152-4ad9-487b-8e5a-24a06298417f', // ONETRUST README DEBUG IDENTIFIER
'it',
// params,
);
log("STATUS: $status");
} on PlatformException {
print("Error communicating with platform-side code");
}
if (!mounted) return;
setState(() {
_cmpDownloadStatus = status.toString();
});
}
}
The function above is called in the initState
#override
void initState() {
super.initState();
initOneTrust(mounted)
.then((value) => {OTPublishersNativeSDK.showBannerUI()});
}
The banner show without any problems only on android devices with API 29. I can't find any compatibility documentation between the android api and sdk.
On ios the function always return false and no error logs appears.
Some details:
OneTrust SDK Version: 6.25.7
Flutter 2.10.4

Related

OneSignal in Ionic V1 with Android SDK 31+

I'm having problems with my old application built on Ionic V1. From now on we need to use SDK 31 or higher on Android. I made the adjustments in my application but I am not able to make OneSignal work.
Plugin installed: onesignal-cordova-plugin 2.11.3
My app.js:
`
$ionicPlatform.ready(function() {
var notificationOpenedCallback = function(jsonData) {
var data = jsonData.notification.payload.additionalData;
if (data && data.targetUrl) {
if (data.paramsValue) {
$state.go(data.targetUrl, { paramID : data.paramsValue } );
}else{
$state.go(data.targetUrl);
}
}
//alert("Notification opened:\n" + JSON.stringify(jsonData));
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
};
// TODO: Update with your OneSignal AppId before running.
window.plugins.OneSignal
.startInit("MY_ID_ONESIGNAL")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
window.plugins.OneSignal.getIds(function(ids) {
$localStorage.pushToken = ids.userId;
$rootScope.pushToken = ids.userId;
//alert("player id: " + ids.userId);
});
window.plugins.OneSignal.getPermissionSubscriptionState(function(status) {
idapp = status.subscriptionStatus.userId;
});
`
I tried to update the OneSignal cordova plugin to the latest version but it still doesn't work, it's likely that the app.js needs to be changed.

Expo-google-app-auth gives error while signing in

I'm making an app in react native and really need to add google auth. But I can't get it to work. It shows an error: ExpoAppAuth.Get Auth: Encountered exception when trying to start auth request: null
Code
My Sign-In function
signInAsync = async () => {
try {
const conf = {
androidClientId: config.google_client_id,
}
let result = await Google.logInAsync(conf);
if (result.type === 'success') {
console.log(result.accessToken);
this.props.navigation.navigate('dashboard');
} else {
return { cancelled: true };
}
} catch (e) {
console.error(e.message);
return { error: true };
}
};
Versions
windows 10.0.19043.1466
node.js v16.13.1
npm 8.1.2
expo-google-app-auth ~9.0.0
expo 5.0.3
Android studio Arctic Fox 2020.3.1
Emulator Pixel 5 api 30
Android 11.0

Flutter | PurchaseDetails.billingClientPurchase was removed at in_app_purchase than 0.60

There is one significant regression in the in_app_purchase 0.6.0
In 0.5.2, PurchaseDetails contained the billingClientPurchase field with additional Android related information.
The billingClientPurchase contained one very important piece of information: signature.
This signature is required to locally verify a purchase. In 0.6.0, one can only find PurchaseDetails.verificationData.localVerificationData (another important piece of data), but no signature can be received.
Please could you add the signature as well?
Future<bool> _verifyPurchase(PurchaseDetails purchaseDetails) async
{
if (Platform.isAndroid) {
try {
final body = json.encode({
'signature': purchaseDetails.billingClientPurchase.signature, // Compile error
'receipt': purchaseDetails.verificationData.localVerificationData,
})
await http.post(RECEIPT_VERIFICATION_ENDPOINT_FOR_ANDROID, body: body);
purchaseDetails.billingClientPurchase.isAutoRenewing; // Compile error
} catch (e) {
return false;
}
}
return true;
}

React Native : Native method ExpoLocalAuthentication.authenticateAsync expects 0 arguments but received 1

I'm in need of your expertise in React Native.
I'm trying to use expo-local-authentication for local fingerprint authentication for my application.
My project was created using expo init command.
I have done the setup as per the documentation and still running into a strange issue:
Below is the error I'm facing for LocalAuthentication.authenticateAsync(options):
Native method ExpoLocalAuthentication.authenticateAsync expects 0
arguments but received 1
Here is the required part of my code:
import * as LocalAuthentication from 'expo-local-authentication';
const authenticate = async () => {
const hasHardwareAsync = await LocalAuthentication.hasHardwareAsync();
if (hasHardwareAsync) {
const supportedAuthentications = await LocalAuthentication.supportedAuthenticationTypesAsync();
if (supportedAuthentications.indexOf(1) !== -1) {
// Finger print supported
const isFingerprintEnrolled = await LocalAuthentication.isEnrolledAsync();
if (isFingerprintEnrolled) {
const options = {
promptMessage: 'Authenticate yourself',
};
try {
// Also tried with await but it throws the same error
// await LocalAuthentication.authenticateAsync(options)
LocalAuthentication.authenticateAsync(options).then(result => {
// I never get inside this block
console.warn(result)
})
.catch(error => {
console.warn('Authentication Error: ', error)
})
} catch (error) {
console.warn(error)
}
}
}
}
}
Not sure what I'm missing. Seems like there is no information available about the error. I also tried to run the LocalAuthentication.authenticateAsync() without any arguments but it still throws the same error.
Any help on what could be the root cause of the issue and how can I resolve it or any other alternative for local authentication would be highly appreciated.
Update your app to the latest version of expo (38 in my case) and to the latest version of expo-local-authentication, and the error goes away.

Expo React Native google auth with firebase not working in published apk version on android

I wanted to include google Auth in my app but it is not working in the published version on android even though it worked with expo
Here is the code:
logInGoogle = async () => {
try {
const result = await Google.logInAsync({
androidClientId:ID,
iosClientId:ID,
scopes: ["profile", "email"],
behavior:'web'
});
if (result.type === "success") {
const { idToken, accessToken } = result;
const credential = GoogleProvider.credential(idToken, accessToken);
Firebase
.auth()
.signInWithCredential(credential)
.then(function(result){
if(result.additionalUserInfo.isNewUser){
Firebase.database().ref('UserToQuestion/' + Firebase.auth().currentUser.uid).set({
notifier: {
Email:Firebase.auth().currentUser.email
}
})
}
})
.catch(error => {
Alert.alert(error)
console.log("firebase cred err:", error);
});
} else {
return { cancelled: true };
}
} catch (err) {
console.log("err:", err);
}
}
Here is my app.json for android
"android": {
"package": "com.aparson.SFS",
"versionCode": 1
},
In the google console, I have a working service account but I have not configured the OAuth consent screen, but I am not sure if that is the problem because when I click the button for google login nothing happens at all. I have also changed the SHA-1 certificate to what the app signing showed which is what someone said to do in a different question but that did not work either.
I would appreciate it if anyone could help.
Thanks
you should use expo-google-sign-in
expo-google-sign-in provides native Google authentication for standalone Expo apps or bare React Native apps. It cannot be used in the Expo client as the native GoogleSignIn library expects your REVERSE_CLIENT_ID in the info.plist at build-time. To use Google authentication in the Expo client, check out expo-google-app-auth or expo-app-auth.
https://docs.expo.io/versions/latest/sdk/google-sign-in/#googleidentity

Categories

Resources