private void openChat(long provider, long account) { try { IChatSessionManager manager = mConn.getChatSessionManager(); IChatSession session = manager.getChatSession(mToAddress); if (session == null) { session = manager.createChatSession(mToAddress); } Uri data = ContentUris.withAppendedId(Imps.Chats.CONTENT_URI, session.getId()); Intent intent = new Intent(Intent.ACTION_VIEW, data); intent.putExtra(ImServiceConstants.EXTRA_INTENT_FROM_ADDRESS, mToAddress); intent.putExtra(ImServiceConstants.EXTRA_INTENT_PROVIDER_ID, provider); intent.putExtra(ImServiceConstants.EXTRA_INTENT_ACCOUNT_ID, account); intent.addCategory(ImApp.IMPS_CATEGORY); startActivity(intent); } catch (RemoteException e) { // Ouch! Service died! We'll just disappear. Log.w("ImUrlActivity", "Connection disappeared!"); } }