/PushSharp.Client/PushSharp.Client.MonoForAndroid.Gcm/GCMBroadcastReceiver.cs

https://github.com/mustafagenc/PushSharp · C# · 31 lines · 26 code · 5 blank · 0 comment · 0 complexity · 99f5bb11a2521d3b56026d9b4cb8f643 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Android.App;
  6. using Android.Content;
  7. using Android.OS;
  8. using Android.Runtime;
  9. using Android.Views;
  10. using Android.Widget;
  11. using Android.Util;
  12. namespace GCMSharp.Client
  13. {
  14. public class GCMBroadcastReceiver<TIntentService> : BroadcastReceiver where TIntentService : GCMBaseIntentService
  15. {
  16. const string TAG = "GCMBroadcastReceiver";
  17. public override void OnReceive(Context context, Intent intent)
  18. {
  19. Log.Verbose(TAG, "OnReceive: " + intent.Action);
  20. var className = context.PackageName + GCMConstants.DEFAULT_INTENT_SERVICE_CLASS_NAME;
  21. Log.Verbose(TAG, "GCM IntentService Class: " + className);
  22. GCMBaseIntentService.RunIntentInService(context, intent, typeof(TIntentService));
  23. SetResult(Result.Ok, null, null);
  24. }
  25. }
  26. }