c# - Push-notifications and MVVMCross -
we facing problem handling notification on android mvvmcross.
i implemented default void createnotification()
when tap notification in notification center, oncreate()
fails following exception:
system.nullreferenceexception: object reference not set instance of object
the code using:
var notificationmanager = (notificationmanager)getsystemservice(notificationservice); //create intent show ui var uiintent = new intent(this, typeof(homeview)); var notification = new notification(android.resource.drawable.staron, title); notification.flags = notificationflags.autocancel; notification.setlatesteventinfo(this, title, desc, pendingintent.getactivity(this, 0, uiintent, pendingintentflags.updatecurrent)); notificationmanager.notify(1, notification);
the homeview in sample of type:
public abstract class mvxbindingactivityview : cirrious.mvvmcross.droid.views.mvxactivityview tviewmodel : class, cirrious.mvvmcross.interfaces.viewmodels.imvxviewmodel member of cirrious.mvvmcross.binding.droid.views
can fix problem?
thanks, christian
providing nullreference exception without trace or call stack info asking 'long shot' guesses... please try provide more if can - eg catching exception , tracing callstack and/or looking @ output window or monitor.bat trace.
with said, long shots... , suspect problem in way showing activity - show mvxactivity need provide serialised mvxviewmodlerequest in intent extras - easiest way use showviewmodel api on mvxnavigatingobject (mvxapplicationobject in vnext). alternatively can use object implements https://github.com/slodge/mvvmcross/blob/vnext/cirrious/cirrious.mvvmcross.droid/interfaces/imvxandroidviewmodelrequesttranslator.cs
- can using ioc
i hope guess right - if not, stack trace , log output please :)
stuart
Comments
Post a Comment