The AppId is NULL or not an instance of UUID in NotificationService

asked 2014-11-11 01:41:22 -0700

almcalle gravatar image

updated 2014-11-13 00:35:31 -0700

When I'm running my client I have the following exception when I try to send a notification with the Notification Service:

      org.alljoyn.ns.NotificationServiceException: The AppId is NULL or not an instance of UUID

The code where I define AppId and I put the valors in a custom PropertyStore class

           Map < String, Map < String, Object >> defaultMap = new HashMap < String, Map
           <  String, Object > >();

            UUID uuid = UUID.randomUUID();

            Map < String, Object > defaultAppId = new HashMap <String, Object>();

            defaultAppId.put("", TransportUtil.uuidToByteArray(uuid));

            defaultMap.put("AppId", defaultAppId);

and I save the valors to a custom PropertyStore class that I use to launch a notification service How can I solve this problem? I'm using Windows 7 with eclipse and jre1.8.0_25

Thanks for the help!

Edit1: Here is the rest of the code:

public class Cliente {


static BusAttachment mBus;
static boolean sesion=false;
static ProxyBusObject Proxy ;
static Interfaz mInterfaz;
private static final short PORT=91; 
static NotificationSender sender;
static NotificationService servnot;
static AboutService aboutService;
static AboutStore aboutStore;

public static void main(String[] args) {

    mBus=new    BusAttachment("HolaMundo");




    aboutService = AboutServiceImpl.getInstance();




    try {
        sender=servnot.initSend(mBus, aboutStore);
    } catch (NotificationServiceException e3) {
        // TODO Auto-generated catch block

    Status status =mBus.findAdvertisedName("com.almcalle.hola");

    System.out.println("Buscando Sesion");        


        try {
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block



    try {
        System.out.println("Funciona? " + mInterfaz.Holamundo());
    } catch (BusException e) {
        // TODO Auto-generated catch block
    System.out.println("Enviar Notificacion ");

    List<NotificationText> list=new ArrayList<NotificationText>();;
    NotificationText text = null;
    try {
        text = new NotificationText("ES","ola k ase");
    } catch (NotificationServiceException e1) {
        // TODO Auto-generated catch block


    Notification notification=null;
    try {
        notification = new Notification(NotificationMessageType.INFO, list);
    } catch (NotificationServiceException e) {
        // TODO Auto-generated catch block
        try {
            sender.send(notification, 30);
        } catch (NotificationServiceException e) {
            // TODO Auto-generated catch block


    System.out.println("Notificacion Enviada");


private static void startSender() {

    //////start about

    ////////end about

    try {
        aboutService.startAboutServer( PORT,  aboutStore ,mBus);
    } catch (Exception e2) {
        // TODO Auto-generated catch block

    try {
        sender=servnot.initSend(mBus,  aboutStore);
    } catch (NotificationServiceException e) {
        // TODO Auto-generated catch block


private static void RegistrarBus() {
    // TODO Auto-generated method stub
    mBus.registerBusListener(new BusListener() {
        public void foundAdvertisedName(String name, short transport, String namePrefix) {

            System.out.println(String.format("BusListener.foundAdvertisedName(%s, %d, %s)", name, transport, namePrefix));
            short contactPort=PORT;
            SessionOpts opts= new SessionOpts();
            opts.traffic = SessionOpts.TRAFFIC_MESSAGES;
            opts.isMultipoint = false;
            opts.proximity = SessionOpts.PROXIMITY_ANY;
            opts.transports = SessionOpts.TRANSPORT_ANY;

            Mutable.IntegerValue sessionId = new Mutable.IntegerValue();
            System.out.println("Creando Sesion"); 


            Status status = mBus.joinSession(name, contactPort, sessionId, opts,    new SessionListener());

            String cad=status.toString();
            System.out.println("Status: "+cad);

            Proxy= mBus.getProxyBusObject("com.almcalle.hola", "/almcalle/Hola", sessionId.value, new Class<?>[] { Interfaz.class});

            System.out.println("Proxy Creado");  


private static void CrearStore(){

    Map < String, Map < String, Object >> defaultMap = new HashMap < String, Map < 
            String, Object > >();
    // Populate ...
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-11-13 00:49:57 -0700

almcalle gravatar image

My problem was in AboutStore.checkLanguage, It was not working well. To make my code works I only had to Erase in AboutStore.readAll() the line:

languageTag = checkLanguage(languageTag);

Now it is working well! Thank you for your help

edit flag offensive delete publish link more

answered 2014-11-11 15:39:04 -0700

bspencer gravatar image

Going out on a limb here... but did you setup your AboutService? The Notification service pulls the AppId out of the AboutService instance. If it's not setup, then you will not be able to send a Notification using the Notification Service code. You should change your code to add the AboutService.

Another option, modify the Notification Service code or re-implement the Notification service yourself to avoid this error/requirement. I would not recommend this, as you should be advertising the application existence via the About feature, but the project is Open Source so have fun.

You should use the NotificationServiceSample in Android as an example of how to setup and then send a Notification using the Java language binding. You should look at the startSender() method of the mentioned code.

edit flag offensive delete publish link more


I think the error is inTransport.java:120, it uses Property.NO_LANGUAGE and I'm using in my custom PropertyStore the value "" (empty String) and not Property.NO_LANGUAGE. The problem now is that I can't import org.alljoyn.services.android.storage.Property or know the value of Property.NO_LANGUAGE

almcalle ( 2014-11-12 03:45:52 -0700 )edit

https://git.allseenalliance.org/cgit/services/base.git/tree/sample_apps/android/common_utils/src/org/alljoyn/services/android/storage/Property.java NO_LANGUAGE is "", so that should not be the issue. Can you amend the original ask with more code snippets?

bspencer ( 2014-11-12 12:26:12 -0700 )edit
Login/Signup to Answer

Question Tools



Asked: 2014-11-11 01:41:22 -0700

Seen: 469 times

Last updated: Nov 13 '14