No matter how I try, it seems I get can’t the MediaRecordingExtension which implements PacketExtension created by my MediaRecordingProvider. I can see it’s running through the Provider and its parser, but I can’t figure out how to get MediaRecordingExtension back after that. I was hoping someone could give me a little guidance about how to achive this.
**Here's how I connect: ** // Add custom extension provider ProviderManager.getInstance().addExtensionProvider( MediaRecordingExtension.elementName, MediaRecordingExtension.namespace, new* MediaRecordingProvider()*); // Config our connection ConnectionConfiguration config = new ConnectionConfiguration(mServer, mPort); config.setSASLAuthenticationEnabled(true); connection = new XMPPConnection(config); // Connect to device connection.connect(); connection.addConnectionListener(connectionListener); connection.addPacketListener(new PacketListener(){ @Override public void processPacket(Packet p) { PacketExtension pe = p.getExtension(MediaRecordingExtension.namespace); if (pe instanceof MediaRecordingExtension){ MediaRecordingExtension e = (MediaRecordingExtension) pe; System.out.println(e.getId()); } else { System.out.println("It is NOT an instance of MediaRecordingExtension"); } } }, new PacketTypeFilter(Message.class)); **Here's how I subscribe (which really kinda sucks): ** subscribeNode("urn:fake-com:fake-alert:remote-event:device:media:recording:motio n-detected"); private void subscribeNode(final String node){ //Build the subscribe request for the current user. IQ iqPacket = new IQ() { public String getChildElementXML() { return "" + "" + "" + "" + "" + "[http://jabber.org/protocol/pubsub#subscribe_options](http://jabber.org/protocol/pubsub#subscribe_options)" + "" + ""+ "items" + ""+ "" + ""+ ""; } }; iqPacket.setType(IQ.Type.SET); iqPacket.setFrom(connection.getUser()); iqPacket.setTo(mServerJid); connection.sendPacket(iqPacket); } **Here is the event response from the event I subscribed too above after I got a successful 'subscribed' response from the above subscription request:** /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAB=
Once I receive this subscribed event, I can see that the packet travels through the *MediaRecordingProvider() *and is parsed into a MediaRecordingExtension there properly, but after that, the PacketListener processPacket method above results in: “It is NOT an instance of MediaRecordingExtension”, and I can’t figure out why. I’m not sure how to get my MediaRecordingExtension back once its parsed.
Also, I hate the way I have to subscribe for this event. I really don’t like the custom XML there to create this and am open to better ideas for this.
Can someone point me in the right direction? I’m interested in any input anyone might have.
Thank you,
Gary Tessman