old mode 100755
new mode 100644
| | |
| | | using Microsoft.AppCenter; |
| | | using Microsoft.AppCenter.Analytics; |
| | | using Microsoft.AppCenter.Crashes; |
| | | using Com.Tencent.MM.Sdk.Openapi; |
| | | |
| | | namespace com.hdl.home |
| | | { |
| | | /// <summary>
/// 设定为默认启动的Application
/// </summary>
[Android.App.Application]
public class Application : Android.App.Application
{
public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { }
public override void OnCreate()
{
//安卓配网初始
//var result = Com.Mediatek.Elian.ElianNative.LoadLib();
//if (!result)
//{
// System.Console.WriteLine("Error,can't load elianjni lib");
//} |
| | | |
| | | initAll();
base.OnCreate();
} |
| | | [Activity(Name = "com.hdl.home.wxapi.WXEntryActivity", Exported = true, Theme = "@android:style/Theme.Translucent", LaunchMode = Android.Content.PM.LaunchMode.SingleTask)] |
| | | class WXEntryActivity : Android.App.Activity, IWXAPIEventHandler |
| | | { |
| | | public void OnReq(BaseReq p0) |
| | | { |
| | | |
| | | } |
| | | protected override void OnNewIntent(Intent intent) |
| | | { |
| | | base.OnNewIntent(intent); |
| | | Intent = intent; |
| | | api.HandleIntent(intent, this); |
| | | Finish(); |
| | | } |
| | | public void OnResp(BaseResp p0) |
| | | { |
| | | |
| | | if (p0 is SendAuth.Resp) |
| | | { |
| | | var resp = p0 as SendAuth.Resp; |
| | | |
| | | switch (resp.ErrCode) |
| | | { |
| | | case SendAuth.Resp.InnerErrCode.ErrOk: |
| | | var result = new System.Net.WebClient { }.DownloadData($"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx2ec8f53f6fa36e82&secret=a08585cd6ff2ce64570b9e7e6525dd8e&code={resp.Token}&grant_type=authorization_code"); |
| | | break; |
| | | case SendAuth.Resp.InnerErrCode.ErrUserCancel: |
| | | break; |
| | | case SendAuth.Resp.InnerErrCode.ErrAuthDenied: |
| | | break; |
| | | |
| | | } |
| | | } |
| | | this.Finish(); |
| | | } |
| | | IWXAPI api; |
| | | protected override void OnCreate(Bundle savedInstanceState) |
| | | { |
| | | base.OnCreate(savedInstanceState); |
| | | // 通过WXAPIFactory工厂,获取IWXAPI的实例 |
| | | api = WXAPIFactory.CreateWXAPI(this, "wx2ec8f53f6fa36e82", false); |
| | | |
| | | // 将应用的appId注册到微信 |
| | | api.RegisterApp("wx2ec8f53f6fa36e82"); |
| | | |
| | | api.HandleIntent(Intent, this); |
| | | } |
| | | } |
| | | /// <summary>
/// 设定为默认启动的Application
/// </summary>
[Android.App.Application]
public class Application : Android.App.Application
{
public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { }
public override void OnCreate()
{ |
| | | //安卓配网初始 |
| | | //var result = Com.Mediatek.Elian.ElianNative.LoadLib(); |
| | | //if (!result) |
| | | //{ |
| | | // System.Console.WriteLine("Error,can't load elianjni lib"); |
| | | //} |
| | | initAll();
base.OnCreate(); |
| | | // 通过WXAPIFactory工厂,获取IWXAPI的实例 |
| | | api = WXAPIFactory.CreateWXAPI(this, "wx2ec8f53f6fa36e82", true); |
| | | |
| | | // 将应用的appId注册到微信 |
| | | api.RegisterApp("wx2ec8f53f6fa36e82"); |
| | | } |
| | | |
| | | IWXAPI api; |
| | | |
| | | |
| | | /// <summary>
/// 所有初始化全部在这个方法实现
/// </summary>
void initAll()
{
BaseActivity.IsEnnableGPS = false; |