protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); MessagingCenter.Subscribe <object>(this, MainPage.QQShare, o => { var para = new Bundle(); para.PutInt(QQShare.ShareToQqKeyType, QQShare.ShareToQqTypeDefault); para.PutString(QQShare.ShareToQqTitle, "这是来自Xamarin的QQ分享"); para.PutString(QQShare.ShareToQqTargetUrl, "https://mp.weixin.qq.com/s?__biz=MzUyMjMyNDkyNA==&mid=2247483866&idx=1&sn=51892c4dbca89f3a370a3404184c003a&chksm=f9ccdf09cebb561f6fcc6fa22a5e0c347966cb4dc9c35468ac492d45832327f6f709deb40f18&token=532895856&lang=zh_CN#rd"); tencent.ShareToQQ(this, para, new UiListener()); }); MessagingCenter.Subscribe <object>(this, MainPage.QQLogin, o => { loginUIListener = new UiListener(); var result = tencent.Login(this, "all", loginUIListener); }); tencent = Tencent.CreateInstance("1110576152", ApplicationContext, "com.tencent.sample.fileprovider"); }
/// <summary> /// https://wiki.connect.qq.com/qq%e7%99%bb%e5%bd%95 /// <para>Tencent类是SDK的主要实现类,开发者可通过Tencent类访问腾讯开放的OpenAPI。</para> /// <para>其中APP_ID是分配给第三方应用的appid,类型为String。</para> /// <para>其中Authorities为 Manifest文件中注册FileProvider时设置的authorities属性值 </para> /// </summary> /// <param name="context"></param> /// <returns></returns> public static Tencent GetTencent(Context context) { var tencent = Tencent.CreateInstance( APP_ID, context.ApplicationContext, GoToPlatformPages.GetAuthority(context)); return(tencent !); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); _tv = FindViewById <TextView>(Resource.Id.textView1); _tencent = Tencent.CreateInstance("1106970090", this.ApplicationContext); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; }
/// <summary> /// API 包装 /// </summary> /// <param name="appId"></param> /// <param name="activity"></param> /// <param name="appName">手Q客户端顶部,替换“返回”按钮文字,如果为空,用返回代替</param> public api(string appId, Activity activity, string appName) { tencent = Tencent.CreateInstance(appId, this.activity = activity); this.appName = appName; }