sendPush() not working?


(Tim Slagle) #1

All of my apps are failing at any line of code that sends a push message. Did this change?

Anyone seeing similar things? I am sending a note to support and will report back.


Smart Alarm is here
sendPush() broken?
sendPush error
(Tim Slagle) #2

Getting the following with a simple sendPush() string

I am trying to send “test” using sendPush(“test”)

groovy.lang.MissingMethodException: No signature of method: physicalgraph.notification.NotificationService.sendPush() is applicable for argument types: (physicalgraph.app.InstalledSmartApp, test, null) values: [Magic Home Test, test, null]
Possible solutions: sendPush(physicalgraph.device.cache.InstalledSmartAppDTO, java.lang.String), sendPush(physicalgraph.device.cache.InstalledSmartAppDTO, java.lang.String, java.util.Map) @ line 132

@ben @urman can someone take a look at this?


(Geko) #3

That would explain why Smart Alarm cannot send push messages. :frowning:
Looks like the API has changed - need two arguments now.


(Tim Slagle) #4

Looks like it. Just trying to figure out what the other argument would be? I’m trying to isolate what is causing it now but can’t. Same logic in one of my apps is working fine all the others aren’t.

Has smart alarm not been able to push notifications since saturday?


(Tim Slagle) #5

Ok, so i isolated my problem i think.

Only took me 2 days lol… This was happening on install and it wouldn’t let the app install. Apparently you cannot send a push during the app install? If the push is sent after the initialization process it seems to send just fine…

This did work not more than 2 days ago though.

Weird stuff. Don’t know if thats the same for you @geko :frowning:


(Geko) #6

I haven’t tried. Someone reported that push notifications were not working, so I thought it might be it. Will test when I get back home tonight.


(Geko) #7

You’re right. The error only occurs when senPush() is called during install(). Still it’s sucks because it was working before the platform upgrade. I don’t know how many things they fixed but they surely broke quite a few. :-\


(Matt Martz) #8

Is there a resolution to this? The code for my app still isn’t pushing messages and it’s not during install()


(Tim Slagle) #9

You have to protect any push messages during the isntall of the app. I did this by setting up a “runIn” to run 60 seconds after the app install.


(Matt Martz) #10

Eh… I’m not following. What am I running 60 seconds after the app install? Messages that get sent by my app happen well after install.

Do you have some code I can reference for example?


(Tim Slagle) #11

Had to have my app “start” 60 seconds later.

def initialize() {
    runIn(60, checkSun)
	subscribe(location, "sunrise", setSunrise)
	subscribe(location, "sunset", setSunset)
}

(Matt Martz) #12

I promise I’m not trying to be difficult… but maybe showing the code I’m talking about will help:

Messages get sent at the bottom… all initialize does is subscribes to events.

I noticed that the error message and someone above referenced a second variable in the sendPush part… does anyone know what that second variable should be?

The above code worked fine pre-update.


(Tim Slagle) #13

sendPush is only broke durring inistialization. If you aren’t getting pushes after the app is installed then something in your code is broke.