java/srcPubnubApi/com/pubnub/api/PubnubCore.java
/**
     * Read presence information from a channel or a channel group
     *
     * @param channels      array
     * @param channelGroups array
     * @param state         state enabled ?
     * @param uuids         enable / disable returning uuids in response ?
     * @param callback      object of sub class of Callback class
     */
Read presence information from a channel or a channel group
@param channels      array
@param channelGroups array
@param state         state enabled .
@param uuids         enable / disable returning uuids in response .
@param callback      object of sub class of Callback class
Read presence information from a channel or a channel group @param channels array @param channelGroups array @param state state enabled . @param uuids enable / disable returning uuids in response . @param callback object of sub class of Callback class
public void hereNow(String[] channels, String[] channelGroups, boolean state,
                        boolean uuids, Callback callback) {
        final Callback cb = getWrappedCallback(callback);
        Hashtable parameters = PubnubUtil.hashtableClone(params);
        ArrayList urlArgs = new ArrayList();
        urlArgs.add(getPubnubUrl());
        urlArgs.add("v2");
        urlArgs.add("presence");
        urlArgs.add("sub_key");
        urlArgs.add(this.SUBSCRIBE_KEY);
        if (channels != null || channelGroups != null) {
            String channelsString = PubnubUtil.joinString(channels, ",");
            if ("".equals(channelsString)) {
                channelsString = ",";
            } else {
                channelsString = PubnubUtil.urlEncode(channelsString);
            }
            urlArgs.add("channel");
            urlArgs.add(channelsString);
        }
        if (state) parameters.put("state", "1");
        if (!uuids) parameters.put("disable_uuids", "1");
        if (channelGroups != null && channelGroups.length > 0) {
            parameters.put("channel-group", PubnubUtil.joinString(channelGroups, ","));
        }
        String[] path = (String[]) urlArgs.toArray(new String[urlArgs.size()]);
        HttpRequest hreq = new HttpRequest(path, parameters,
                new ResponseHandler() {
                    public void handleResponse(HttpRequest hreq, String response) {
                        invokeCallback(null, response, "payload", cb, 1);
                    }
                    public void handleError(HttpRequest hreq, PubnubError error) {
                        cb.errorCallback(null, error);
                    }
                });
        _request(hreq, nonSubscribeManager);
    }
public void hereNow ( String [ ] channels , String [ ] channelGroups , boolean state , boolean uuids , Callback callback ) { final Callback cb = getWrappedCallback ( callback ) ; Hashtable parameters = PubnubUtil . hashtableClone ( params ) ; ArrayList urlArgs = new ArrayList ( ) ; urlArgs . add ( getPubnubUrl ( ) ) ; urlArgs . add ( "v2" ) ; urlArgs . add ( "presence" ) ; urlArgs . add ( "sub_key" ) ; urlArgs . add ( this . SUBSCRIBE_KEY ) ; if ( channels != null || channelGroups != null ) { String channelsString = PubnubUtil . joinString ( channels , "," ) ; if ( "" . equals ( channelsString ) ) { channelsString = "," ; } else { channelsString = PubnubUtil . urlEncode ( channelsString ) ; } urlArgs . add ( "channel" ) ; urlArgs . add ( channelsString ) ; } if ( state ) parameters . put ( "state" , "1" ) ; if ( ! uuids ) parameters . put ( "disable_uuids" , "1" ) ; if ( channelGroups != null && channelGroups . length > 0 ) { parameters . put ( "channel-group" , PubnubUtil . joinString ( channelGroups , "," ) ) ; } String [ ] path = ( String [ ] ) urlArgs . toArray ( new String [ urlArgs . size ( ) ] ) ; HttpRequest hreq = new HttpRequest ( path , parameters , new ResponseHandler ( ) { public void handleResponse ( HttpRequest hreq , String response ) { invokeCallback ( null , response , "payload" , cb , 1 ) ; } public void handleError ( HttpRequest hreq , PubnubError error ) { cb . errorCallback ( null , error ) ; } } ) ; _request ( hreq , nonSubscribeManager ) ; }
Read presence information from a channel or a channel group
 @param channels      array
 @param channelGroups array
 @param state         state enabled ?
Read presence information from a channel or a channel group @param channels array @param channelGroups array @param state state enabled ?