抛出异常
java.lang.ExceptionInInitializerError 在com.sinch.android.rtc.internal.client.ServiceFactory.createUserAgent(ServiceFactory.java:44)
问题发生在sinchClient = Sinch.getSinchClientBuilder()。context(this).userId(username).applicationKey(APP_KEY) .applicationSecret(APP_SECRET).environmentHost(环境).build();
我的代码是: -
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
ParseQuery<ParseObject> qry=ParseQuery.getQuery("_User");
qry.whereEqualTo("username",(String)LoginFrag.name.getText().toString().trim());
qry.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> obj, ParseException e) {
// TODO Auto-generated method stub
if(e==null)
{
for (ParseObject dealsObject : obj) {
username=(String) dealsObject.get("username");
startSinchClient(username);
Log.i("MessageService", "calling startSinchClient"+" "+username);
}
}
}
});
broadcaster = LocalBroadcastManager.getInstance(this);
Log.i("MessageService", "broadcast started");
return super.onStartCommand(intent, flags, startId);
}
public void startSinchClient(String username) {
sinchClient = Sinch.getSinchClientBuilder().context(this).userId(username).applicationKey("xxxxxx")
.applicationSecret("xxxxxxxxxx").environmentHost("xxxxxxxxx").build();
sinchClient.addSinchClientListener(this);
sinchClient.setSupportMessaging(true);
sinchClient.setSupportActiveConnectionInBackground(true);
sinchClient.checkManifest();
sinchClient.start();
}
正确检查了APP_KEY,SECRET_KEY和环境。