0

AJ.notification().receive() method required

asked 2015-04-07 06:07:40 -0700

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi,

I am trying alljoyn-js in raspberry. With

AJ.notification(AJ.notification.Info,"Hello,World").send(1000);

I can able to recevie notification to Android mobile. But, I am interesting to have something like

AJ.notification().receive();

to receive notification on raspberry terminal from android mobile.

I searched a lot to use this kind of functionality in my code. I found these links related my requirement

AllJoyn Signals, Methods and Properties Documentation.txt

library/alljoyn.js

I am not from Java Script background, I am not able to go deep with these links. Firstly, I want to know "Is this a good one to experiment with it?" or "Is there already receive notification implemented on alljoyn-js as well?".

I have these Questions at me. Hope you will give some clarification on my Question.

Thanks,

Ganesh

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-04-07 10:20:13 -0700

jprestwo gravatar image

updated 2015-04-07 16:04:12 -0700

To receive a notification in AllJoyn.js you need to add a match rule for the notification interface:

AJ.addMatch('org.alljoyn.Notification', 'notify');

Then add the onSignal function and check for the notify signal:

AJ.onSignal = function() {
    if (this.member == 'notify') {
        //here you can access the arguments[] array
        //arguments[x] is one of the many arguments in the notif signal
        //this will print them all as a JSON string
        print(JSON.stringify(arguments));
    }
}

I'm not sure what you mean by "is this a good one to experiment with". If you mean this example then yes as you can see its very simple to receive notifications. Regardless if you have little JavaScript background, AllJoyn.js is very easy to use. You should be able to pick it up very quickly.

edit flag offensive delete publish link more

Comments

Thanks jprestwo. It is working awesome.

kgan4dev ( 2015-04-07 22:03:47 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-04-07 06:07:40 -0700

Seen: 231 times

Last updated: Apr 07 '15