Hello,
I was hoping for some help with this.
I am trying to send a notification to my Pebble, I believe I can do this with Intents, and I found this online:
http://s476905316.websitehome.co.uk/blog/?p=612
Apparently it is possible from Llama, however I am not certain for the correct format for Automagic.
I am using the action "Broadcast Intent" with com.getpebble.action.SEND_NOTIFICATION as action, I also add the following extras:
putString("messageType", "PEBBLE_ALERT");
putString("sender", "Automagic");
putString("notificationData", "[{\"title\":\"Test Notification\",\"body\":\"This is a test event\"}]");
I believe this should work but it does not, am I correct?
Here is the info from Pebble:
http://developer.getpebble.com/1/03_API ... 3_Android/
Thanks,
Sam.
Pebble Intents
Moderator: Martin
Re: Pebble Intents
Hello Sam
Unfortunately I don't have a pebble to test it but it could be caused by the variable replacement support in strings in the last putString statement:
putString("notificationData", "[{\"title\":\"Test Notification\",\"body\":\"This is a test event\"}]");
Automagic will try to evaluate the text between the curly brackets as an expression.
You can use single quotes and remove the double quote escape to see if this fixes the problem:
putString("notificationData", '[{"title":"Test Notification","body":"This is a test event"}]');
Regards
Martin
Unfortunately I don't have a pebble to test it but it could be caused by the variable replacement support in strings in the last putString statement:
putString("notificationData", "[{\"title\":\"Test Notification\",\"body\":\"This is a test event\"}]");
Automagic will try to evaluate the text between the curly brackets as an expression.
You can use single quotes and remove the double quote escape to see if this fixes the problem:
putString("notificationData", '[{"title":"Test Notification","body":"This is a test event"}]');
Regards
Martin
Re: Pebble Intents
Martin,
Thanks!
That did the trick!
Thanks!
That did the trick!

Re: Pebble Intents
Hi Martin,Martin wrote: You can use single quotes and remove the double quote escape to see if this fixes the problem:
putString("notificationData", '[{"title":"Test Notification","body":"This is a test event"}]');
Regards
Martin
I am trying to do the same and it works but now I am not too sure how to pass a variable to this expression.
Could you please give us an example?
Also if it is not too much trouble - would it be possible to create a special action for Pebble in your next release? It is quite difficult and time consuming to fill in all this fields.
Many thanks.
P.S. I know about PebbleNotifier but it behaves strangely - it may stop working for unknown reason and then start working again.
However sending a broadcast seems to be working all the time - this is why I want to be able to send a broadcast my myself rather then relying on PN.
Re: Pebble Intents
Hi,
You can concatenate multiple strings using the + operator and add the variable in the middle:
I can add an entry to my todo-list to add a special pebble action but I can not promise anything yet and it will certainly take quite some time since the list is growing faster than I can actually implement the features.
Regards,
Martin
You can concatenate multiple strings using the + operator and add the variable in the middle:
Code: Select all
title = "Testtitle";
body = "Testbody";
data = '[{"title":"' + title + '","body":"' + body + '"}]';
putString("notificationData", data);
Regards,
Martin