protected override void OnCreate(Bundle savedInstanceState) { // ------------------------------------------------------------------------------------------------------------------------------------- // Config appid and env ZaloPaySDK.Init(120987, VN.Zalopay.Sdk.Environment.Sandbox); // ------------------------------------------------------------------------------------------------------------------------------------- TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Forms.Forms.SetFlags("SwipeView_Experimental"); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); // ------------------------------------------------------------------------------------------------------------------------------------- MessagingCenter.Subscribe <Xamarin.Forms.Application, string>(Xamarin.Forms.Application.Current, "PayOrder", (sender, zpTransToken) => { PayOrderListener payOrderListener = new PayOrderListener(); // Define URI schema in AndroidManifest.xml ZaloPaySDK.Instance.PayOrder(this, zpTransToken ?? string.Empty, "demozpdk://xamarinapp", payOrderListener); //Intent intent = new Intent(this.ApplicationContext, typeof(PayOrderListener)); //intent.AddFlags(ActivityFlags.NewTask); ////intent.AddFlags(ActivityFlags.SingleTop); //intent.PutExtra("zptranstoken", zpTransToken); ////StartActivityForResult(intent, 0); //StartActivity(intent); }); // ------------------------------------------------------------------------------------------------------------------------------------- }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Xamarin.Forms.Forms.SetFlags("SwipeView_Experimental"); global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); ZaloPaySDK.SharedInstance().InitWithAppId(int.Parse(Constants.APP_ID), "demozpdk://xamarinapp", ZPZPIEnvironment.Sandbox); ZPPaymentDelegateImplement zPPaymentDelegate = new ZPPaymentDelegateImplement(); // ------------------------------------------------------------------------- MessagingCenter.Subscribe <Xamarin.Forms.Application, string>(Xamarin.Forms.Application.Current, "PayOrder", (sender, zpTransToken) => { ZaloPaySDK.SharedInstance().PaymentDelegate = zPPaymentDelegate; ZaloPaySDK.SharedInstance()?.PayOrder(zpTransToken); }); // ------------------------------------------------------------------------- return(base.FinishedLaunching(app, options)); }