Flutter Razor Pay integration - android

how does this package (razorpay_flutter 1.3.4) works in flutter. In the official docs it says (This flutter plugin is a wrapper around our Android and iOS SDKs.) how exactly does this package manage to integrate in flutter. Does it install the official android or iOS SDK while runtime or in app build time
Is there a way to use Native SDK in our flutter app
Trying to understand how to use the razor pay SDK properly.

Here is very easy way to implement RazorPay in Flutter app, just follow below steps.
add dependency in your pubspec.yaml.(https://pub.dev/packages/razorpay_flutter)
Feel some details for payment and Add your api key, here is example of that.
var options = {
'key': '<YOUR_KEY_HERE>',
'amount': 100,
'name': 'Acme Corp.',
'description': 'Fine T-Shirt',
'prefill': {
'contact': '8888888888',
'email': 'test#razorpay.com'
}
};
Now we have to open RazorPay Screen and go for pay and here is example of open razorpay screen.
_razorpay.open(options);
I Hope this solution can be work.

Related

React Native Facebook Login Android - Embedded Browser is disabled

I'm developing a facebook login feature for react native using react-native-fbsdk-next. However when testing on android I get this error when trying to login with facebook: "For your account security, logging into Facebook from an embedded browser is disabled."
From looking at node modules it does seem like it's using facebookSdkVersion v12.+. Another thing to note is that I'm testing on an android emulator, could that affect things?
And is there any workaround for this issue or is it just something the client has to deal with?
The library react-native-fbsdk has moved to react-native-fbsdk-next, they error you are facing may be due to the gradle cache issue, please use gradle clean and in the app/build.gradle add this code
ext{
...
facebookSdkVersion = "13.1.0"
}
Try to open the url by Linking react-native package
Linking.openURL(url);

Basic usage of #react-native-firebase/admob gives: "TypeError: (0, _admob.default) is not a function". Is it deprecated? or Why doesnt work?

Is #react-native-firebase/admob deprecated? or just.. Why it doesn't work?
I am using #react-native-firebase/admob (https://rnfb-docs.netlify.app/admob/usage).
Everything works fine before to use "admob()". When I add admob() to the code appears this error:
"TypeError: (0, _admob.default) is not a function"
Do someone know why?
My code below (basic usage):
import React from 'react';
import { Text, View} from 'react-native';
import admob, { MaxAdContentRating } from '#react-native-firebase/admob';
import { InterstitialAd, RewardedAd, BannerAd, TestIds } from '#react-native-
firebase/admob';
import { BannerAdSize} from '#react-native-firebase/admob';
class App extends React.Component{
componentDidMount(){
// this was taked of official page: https://rnfb-docs.netlify.app/admob/usage#installation
admob()
.setRequestConfiguration({
// Update all future requests suitable for parental guidance
maxAdContentRating: MaxAdContentRating.PG,
// Indicates that you want your content treated as child-directed for purposes of COPPA.
tagForChildDirectedTreatment: true,
// Indicates that you want the ad request to be handled in a
// manner suitable for users under the age of consent.
tagForUnderAgeOfConsent: true,
})
.then(() => {
// Request config successfully set!
});
}
render(){
return(
<View style={{
alignItems:"center",
justifyContent:"center",
height:"100%"}}>
<Text style={{color:"black"}}>
Hola
</Text>
<BannerAd
unitId={TestIds.BANNER}
size={BannerAdSize.FULL_BANNER} />
</View>
)
}
}
export default App;
Despite #CodeJoe Answer, I still got confused by different Documentations for the React Native Firebase that where around, hence I spend lots of time and energy to get around it.
I open an issue here where is confirmed that Google removed the AdMob Package since v11.5.0.
AdMob is no longer in Firebase APIs, so this module no longer wraps it, there is no documentation to correct.
However it did exist as recently as v11.5.0 here and if you browse the repository at that point, you may consider the e2e tests for AdMob at the time a primer on "How To Use AdMob" https://github.com/invertase/react-native-firebase/tree/0217bff5cbbf233d7915efb4dbbdfe00e82dff23/packages/admob/e2e
Please, don't be like me and check the correct Documentation and website:
Correct
https://rnfirebase.io
Wrong Wrong Wrong, this refers to an older verison
https://rnfb-docs.netlify.app
The internet has a long memory, so there are stale copies of the docs out and about yes, but rnfirebase.io is always the official and current doc site
Admob was removed completely from the firebase ecosystem by Google so it does not exist here no. There are some community packages for it, our v11.5 version that has it, and we hope to peel our implementation out and update it for the community but it takes time and we are unfortunately still backlogged on official firebase apis, so it has not happened yet
So for AdMob solution I would use another Library, and use react-native-firebase for the Solutions that they currently provide
Alternative Library (August 2021)
DISCLAIMER
React Native Firebase is a great library still for the other packages they provide (Firebase, Analitycs...) and the Admob version 11.5 is still a solution. These are just suggestion for alternatives for Admob.
react-native-admob-alpha Simple and fresh library, recently updated.
react-native-admob-native-ads Another brand new library, they implement Admob Native Advanced Ads.
Expo AdMob (Available also for bare React-Native Projects)
To complete your searching I'll add that Admob is removed from React Native Firebase and there is no plan to implement it again. Only re-host code on an external repository.
Last supported version is 11.5.0
It means if you would like to use RN Firebase Admob before re-host you need to use all other services (like RNF analytics) with this version.
For more info please check https://github.com/invertase/react-native-firebase/issues/5329#issuecomment-843272057
Remember to use
dependencies{
"#react-native-firebase/admob": "11.5.0",
"#react-native-firebase/app": "11.5.0",
}
instead of
dependencies{
"#react-native-firebase/admob": "^11.5.0",
"#react-native-firebase/app": "^11.5.0",
}```
I could solve it.
SOLVED
Just check in the file "package.json" that packages of firebase has the same version, example:
dependencies{
"#react-native-firebase/admob": "^11.5.0",
"#react-native-firebase/app": "^11.5.0"
}
TIP
Works to similars errors.
I am able to use 11.5.0 downgrade trick in react native 0.65.1 for my RewardedAds. I edited the package.json file as said. It didn't work but I managed to run it in a different way:
Close any running react-native related terminals. Uninstall #react-native-firebase/app.
npm uninstall #react-native-firebase/app
Install the #react-native-firebase/app version 11.5.0 directly with this command.
npm install #react-native-firebase/app#11.5.0
After the installation, go to package.json>dependencies and do both packages versions the same(11.5.0) and remove ^.
"#react-native-firebase/admob": "11.5.0",
"#react-native-firebase/app": "11.5.0",
Start the react-native with fresh cache then run-android.
npx react-native start --reset-cache
npx react-native run-android

Why won't expo-updates provide checkForUpdateAsync?

When I transitioned to Expo's Managed Workflow (SDK 37 and now 38 as well), in-app update checking broke.
My code:
import * as Updates from 'expo-updates';
async checkForUpdate() {
const update = await Updates.checkForUpdateAsync();
if (update.isAvailable) {
this.updateApp();
}
}
async updateApp() {
await Updates.fetchUpdateAsync();
Updates.reloadAsync();
}
Logcat shows me that the checkForUpdateAsync() promise is being rejected with this message:
Error: The method or property Updates.checkForUpdateAsync is not available on android, are you sure you’ve linked all the native dependencies properly?
For the record I did install it via expo install expo-updates
Thanks.
I solved this by creating a new Expo project and looking for differences from my many-times-upgraded one. I found two:
I was using off-the-shelf React Native instead of the Expo build, so I changed the dependency in package.json to "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.1.tar.gz"
I also updated my expo version to ^38.0.8, as used by the new project.
Finally, I also deleted some build relics that I had generated during the way, but I think the fix came from one of the steps above.

How to launch external app from an ionic4 app

My app is under Ionic 4 for android and I have to open/run/launch external app (for exemple com.google.android.youtube or com.sygic.truck) -> for instance, any installed app.
I tested many options without any success :
InAppBrowserModule (using application://my.package.name).
Cordova plugin lampaa (I didn't find any ways to use it under angular/ts app type).
I tried also webIntent using package option and action option calling the main Activity.
For InAppBrowserModule, i'm stuck with the http:// protocole appended before my app url.
For Lampaa, i'm stuck with the undefined startApp (even after following other threads suggestions).
And for webIntent, I don't think that it's relevent for my issue.
Any suggestions ?
Thanks in advance !
[EDIT]
I finally make it works !
You can use one of those 2 lines :
this.iab.create('android-app://com.google.android.youtube',"_system");
window.open('android-app://com.google.android.youtube',"_system");
You can replace com.google.android.youtube by any application package name !
You can check if the user is on Android, have the app installed and later open it as follow:
constructor(
private platform: Platform, // from 'ionic-angular'
private appAvailability: AppAvailability, // from '#ionic-native/app-availability'
private iab: InAppBrowser, // from '#ionic-native/in-app-browser'
) {}
openYoutube() {
const package = "com.google.android.youtube"
if(this.platform.is('android')) {
this.appAvailability.check(package)
.then(()=> {
this.iab.create('android-app://'+package, '_system', 'location=yes')
})
.catch(()=> {
// not installed
)
} else {
// not on Android
}
}
For ionic 4 we can use
ionic cordova plugin add cordova-plugin-app-launcher
npm install #ionic-native/app-launcher
You can use the following cordova plugin to check if other apps are installed and launch them.
ionic cordova plugin add cordova-plugin-app-launcher
npm install #ionic-native/app-launcher
Simple Cordova plugin to see if other apps are installed and launch them.

Firebase 3 with ionic 2 google authentication

I am new to mobile app development and ionic 2. I get the google authentication working fine for a web app using angularfire2 but that doesn't work on a mobile device (yet?).
I am using ionic 2 version 2.0.0-beta.35 and firebase 3.2.1
Searching led me to the understanding that for the time being I need to use the google+ plugin for cordova, which I have installed.
I am trying this method in my ts code:
loginWithGooglePlugin()
{
return Observable.create(observer =>
{
// note for iOS the googleplus plugin requires ENABLE_BITCODE to be turned off in the Xcode
window.plugins.googleplus.login(
{
'scopes': 'profile email', // optional, space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
'webClientId': '_google_client_app_id_.apps.googleusercontent.com',
'offline': true, // optional, but requires the webClientId - if set to true the plugin will also return a serverAuthCode, which can be used to grant offline access to a non-Google server
},
function (authData)
{
console.log('got google auth data:', JSON.stringify(authData, null, 2));
let provider = firebase.auth.GoogleAuthProvider.credential(authData.idToken, authData.accessToken);
firebase.auth().signInWithCredential(provider).then((success) =>
{
console.log('success!', JSON.stringify(success, null, 2));
observer.next(success);
}, (error) =>
{
console.log('error', JSON.stringify(error, null, 2))
});
},
function (msg)
{
this.error = msg;
}
);
});
}
But the compiler keeps complaining about two things:
1. window.plugins is unknown. How can I convince ts that it's there?
There is no credential on the GoogleAuthProvider object. Searching yielded this link: firebase docs which says there was a method getCredential, which is not recognized either.
My typings seem to be fine. GoogleAuthProvider itself is recognized.
How can I fix this?
Actually, this is a bug in the typescript definitions. The Firebase team has been notified and is working on a fix. In the meantime use the following workaround:
(<any> firebase.auth.GoogleAuthProvider).credential
In my Ionic2 RC1 + Firebase3.5 + AngularFire2.beta5 project I had the same problem... Google Auth with Popup worked in Browser but not in my Android .APK
Firstly, I add 192.168.1.172 to my Firebase Console authorized domain list and <allow-navigation href="http://192.168.1.172:8100"/> to my config.xml.
After this, I found that installing Cordova InAppBrowser plugin solves my problem definitively.
I didn't need to modify my code, only plug and play, exactly like David East says in his Social login with Ionic blog.

Categories

Resources