Giter Club home page Giter Club logo

pushwooshmvvmcrossplugin's Introduction

Pushwoosh plugin for MvvmCross

MvvmCross plugin that wraps the native Pushwoosh SDK

iOS

On iOS use the MvxPushwooshApplicationDelegate as a base class for your AppDelegate

[Register("AppDelegate")]
public partial class AppDelegate : MvxPushwooshApplicationDelegate
{
	UIWindow _window;

	public override bool FinishedLaunching(UIApplication app, NSDictionary options)
	{
		_window = new UIWindow(UIScreen.MainScreen.Bounds);

		var setup = new Setup(this, _window);
		setup.Initialize();

		var startup = Mvx.Resolve<IMvxAppStart>();
		startup.Start();

		_window.MakeKeyAndVisible();

		return base.FinishedLaunching (app, options);
	}
}

Android

On android you have to set some permissions in the AndroidManifest.xml (See sample project or Pushwoosh documentation). On the main activity you have to set an intent filter and you have to override the OnNewIntent method in the main activity.

[Activity(Label = "View for FirstViewModel")]
	[IntentFilter (new string[]{"pushwoosh.sample.droid.MESSAGE"}, Categories = new string[]{"android.intent.category.DEFAULT"})]
	public class FirstView : MvxActivity<FirstViewModel>
    {

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.FirstView);
        }

		protected override void OnNewIntent(Intent intent)
		{
			(Mvx.Resolve<IPushwooshService> () as PushwooshServiceDroid).CheckIntent (intent);
		}
    }

Cross

In your viewmodel you can now register for push notifications.

public class FirstViewModel : MvxViewModel
{
	private string _hello = "Hello MvvmCross";
    public string Hello
	{ 
		get { return _hello; }
		set { _hello = value; RaisePropertyChanged(() => Hello); }
	}


	public override void Start ()
	{
		base.Start ();

		Mvx.Resolve<IPushwooshService>().Register ();
	}

}

pushwooshmvvmcrossplugin's People

Contributors

jelledamen avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.