asp.net mvc - PushSharp - MismatchSenderID on android -
i trying implement push notifications on android devices. have created google project , generated server api key there.the server app asp.net mvc. client app titanium based , set sender id in config file there. got mismatchsenderid exception. here code:
public void notification() { var objpush = new pushbroker(); objpush.onnotificationsent += notificationsent; objpush.onchannelexception += channelexception; objpush.onserviceexception += serviceexception; objpush.onnotificationfailed += notificationfailed; objpush.ondevicesubscriptionexpired += devicesubscriptionexpired; objpush.ondevicesubscriptionchanged += devicesubscriptionchanged; objpush.onchannelcreated += channelcreated; objpush.onchanneldestroyed += channeldestroyed; objpush.registergcmservice(new gcmpushchannelsettings(configurationmanager.appsettings["googleapikey"])); string registrationid = "apa91bfkexcvpi7f61n0zip9wmwpuyk_-hxalg7japbskphhrxh3ckymqjupdkqmy-_canso1cbkvssufi0cn2jciejg1-rx30aiw7lr8hjnvjwhi_tsyuexdubjvuaqme9lh5lwyd01"; objpush.queuenotification(new gcmnotification().fordeviceregistrationid(registrationid) .withjson("{\"alert\":\"hello world!\",\"badge\":7,\"sound\":\"sound.caf\"}")); objpush.stopallservices(waitforqueuestofinish: true); } static void devicesubscriptionchanged(object sender, string oldsubscriptionid, string newsubscriptionid, inotification notification) { //currently event ever happen android gcm trace.writeline("device registration changed: old-> " + oldsubscriptionid + " new-> " + newsubscriptionid + " -> " + notification); } static void notificationsent(object sender, inotification notification) { trace.writeline("sent: " + sender + " -> " + notification); } static void notificationfailed(object sender, inotification notification, exception notificationfailureexception) { trace.writeline("failure: " + sender + " -> " + notificationfailureexception.message + " -> " + notification); } static void channelexception(object sender, ipushchannel channel, exception exception) { trace.writeline("channel exception: " + sender + " -> " + exception); } static void serviceexception(object sender, exception exception) { trace.writeline("channel exception: " + sender + " -> " + exception); } static void devicesubscriptionexpired(object sender, string expireddevicesubscriptionid, datetime timestamp, inotification notification) { trace.writeline("device subscription expired: " + sender + " -> " + expireddevicesubscriptionid); } static void channeldestroyed(object sender) { trace.writeline("channel destroyed for: " + sender); } static void channelcreated(object sender, ipushchannel pushchannel) { trace.writeline("channel created for: " + sender); }
any highly appreciated.
maybe try 1 of several available gcm modules titanium? http://gitt.io/search?q=gcm
or use arrowdb push notifications (which uses gcm): http://docs.appcelerator.com/platform/latest/#!/guide/configuring_push_services
Comments
Post a Comment