Cohelad
Cohelad

Reputation: 121

Quickblox requestBuilder [or]

requestBuilder.or("userPhone",myPhone,phoneList);
        }
    }

    QBCustomObjects.getObjects("image", requestBuilder, new QBCallbackImpl() {

"phoneList" is arrayList of Strings. now on my device this code work well but on samsung devices i have crash : "java.lang.IllegalArgumentException: Illegal character in query at index 147: https://api.quickblox.com/data/image.."

now i know for sure that the arrayList making the problem, because if i put instead of phoneList just , "00000", "09878889" - it's work fine. what to do? thanks..

Edit:

ArrayList<String> al = new ArrayList<String>();
            HashSet<String> hs = new HashSet<String>();
            hs.addAll(phoneList);
            al.clear();
            al.addAll(hs);

            String[]arrString = new String [al.size()+1];
            for (int j = 0; j < al.size(); j++) {
                String str = al.get(j).toString();
                arrString[j+1]= str;
            }
            arrString[0]= myPhone;
            requestBuilder.or("userPhone",arrString);

this is my solution, but i discovered that if "arrString" is bigger than 600+ it's doesn't work, why is that?

Upvotes: 1

Views: 245

Answers (1)

Rubycon
Rubycon

Reputation: 18346

Let me explain how OR operator works:

1) for example, you have name field

To get all records with name Alex OR Garry use next query:

requestBuilder.or("name", "Alex", "Garry");

2) for example, you have name field and age field

To get all records with name Alex OR age 22 use next query:

requestBuilder.or("name", "Alex");
requestBuilder.or("age", "22");

Try somtehing like this

Upvotes: 1

Related Questions