Attempt to invoke virtual method 'long com.mesibo.api.JNIAPI.random()' on a null object reference

116 Views Asked by At

I want to implement mesibo real time API in my code for audiocall, but still having problem here provided code , random number gives null pointer. what mistake is did here.

  Mesibo api = Mesibo.getInstance();
                    api.init(getApplicationContext());

                    // set path for storing DB and messaging files
                    Mesibo.setPath(Environment.getExternalStorageDirectory().getAbsolutePath());

                    // add listener
                    Mesibo.addListener(this);

                    // set access token
                    if(0 != Mesibo.setAccessToken(access_token)) {
//                        return false;
                    }

                    // set database after setting access token so that it's associated with the user
                    Mesibo.setDatabase("mesibo.db", 0);

                    // Now start mesibo
                    if(0 != Mesibo.start()) {
//                        return false;
                    }
                    Mesibo.UserProfile mProfile = new Mesibo.UserProfile();
                    mProfile.name = "user_name";
                    mProfile.address = "xyz";
1

There are 1 best solutions below

0
On

Post logs and details of the platform. Why have you commented - "return false"? Are you using an emulator or phone?

It is likely that you are passing a wrong token in setAccessToken method and hence mesibo did not initialize. Any attempt to use the Mesibo function without initialization may produce a crash. Check the value of status in Mesibo_onConnectionStatus listener.

https://mesibo.com/documentation/tutorials/get-started/android/

or download the first app here

https://github.com/mesibo/samples/tree/master/android