| | |
| | | |
| | | using System;
|
| | | using Android.App; |
| | | using Android.Content; |
| | | using CN.Jpush.Android.Api; |
| | | using CN.Jpush.Android.Service; |
| | | using HDL_ON; |
| | | using HDL_ON.DAL.Server; |
| | | using Shared; |
| | | using Android.OS; |
| | | |
| | | namespace HDL_ON_Android |
| | | {
|
| | |
|
| | | [BroadcastReceiver(Enabled = true, Exported = false)] |
| | | [Android.App.IntentFilter(new string[] |
| | | { |
| | | "cn.jpush.android.intent.RECEIVE_MESSAGE" |
| | | }, |
| | | //[BroadcastReceiver(Enabled = true, Exported = false)] |
| | | //[Android.App.IntentFilter(new string[] |
| | | //{ |
| | | // "cn.jpush.android.intent.RECEIVE_MESSAGE" |
| | | //}, |
| | | //Categories = new string[]
|
| | | //{ |
| | | // "com.santan.smartcontrol" |
| | | //})] |
| | | |
| | | |
| | | [Android.App.Service(Enabled = true, Exported = false)] |
| | | [Android.App.IntentFilter( |
| | | new string[] { "cn.jpush.android.intent.SERVICE_MESSAGE" }, |
| | | Categories = new string[]
|
| | | { |
| | | "com.santan.smartcontrol" |
| | | })] |
| | | public class JPushReceiver : JPushMessageReceiver |
| | | public class JPushReceiver : JPushMessageService |
| | | {
|
| | |
|
| | |
|
| | | private static string TAG = "JPushReceiver"; |
| | | |
| | | public override void OnMessage(Context p0, CustomMessage p1) |
| | | { |
| | | Console.WriteLine("收到极光推送"); |
| | | base.OnMessage(p0, p1); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 用户点击打开了通知 |
| | | /// 点击通知回调 |
| | |
| | | public override void OnRegister(Context context, string p1) |
| | | { |
| | | base.OnRegister(context, p1); |
| | | Utlis.WriteLine("JPushOnRegister: " + p1); |
| | | Utlis.WriteLine("极光推送-注册成功回调: " + p1); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | |
|
| | | if (Shared.Application.Activity==null) |
| | | {
|
| | | Intent i = new Intent(context, typeof(SplashActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class); |
| | | Intent i = new Intent(context, typeof(SplashActivity)); |
| | | i.SetFlags(ActivityFlags.NewTask); |
| | | context.StartActivity(i);
|
| | | }
|
| | | else |
| | | { |
| | | Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class); |
| | | Intent i = new Intent(context, typeof(BaseActivity)); |
| | | i.SetFlags(ActivityFlags.NewTask); |
| | | context.StartActivity(i); |
| | | } |