Git Product home page Git Product logo

sdkdemoapp3.0_android's Issues

redpacket

redpacket红包的支付方式多些选择, 银行卡,微信,支付宝都一起一个sdk啥时候弄好..

视频录制出错

在htc手机上点击视频录制一直报start failed: -2147483648这个错,还望修复

视频通话不显示昵称

视频通话怎么才能显示昵称而不是id
设置用户信息需要打开聊天页面才能回调,但是项目只有视频通话功能,需要怎么设置昵称?

求studio版本

希望能通过studio一步引用功能和布局的库,类似这样的引用compile 'com.ogaclejapan.smarttablayout:library:1.4.2@aar'
谢谢。

application初始化部分机型报null指针

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:383)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:378)
# at com.hyphenate.chat.EMSessionManager.getLastLoginUser(Unknown Source)
at com.hyphenate.chat.EMClient.init(Unknown Source)
at com.hyphenate.chat.ChatClient.init(ChatClient.java:147)

主页MainActivity多次加载ConversationListFragment,ContactListFragment,SettingsFragment的问题

测试步骤:

  • 在某个/三个fragment里的onResume()方法里打印Log =>Log.d("xxx", "resume is called");
  • 打开开发者选项的不保留活动选项,来模拟应用长期压入后台,MainActivity被系统回收的环境
  • 启动应用,进入主页
  • 按Home键,把应用压入后台
  • 重新打开应用
  • 再次按Home键,把应用压入后台
  • 再次打开应用
    会发现每个Fragment的onResume()回调了三次,按Home键=>重新打开应用 这个步骤重复多少次,每次每个Fragment的onResume()就会回调多少次。

问题原因
主页被系统回收,系统每次尝试恢复主页时,MainActivity的onCreate()就会被回调,代码

getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, conversationListFragment)
                .add(R.id.fragment_container, contactListFragment).hide(contactListFragment).show(conversationListFragment)
                .commit();

就会add新的ConversationListFragment,ContactListFragment对象,而以前add的三个fragment并没有被remove掉,所以MainActivity就会加载多个ConversationListFragment,ContactListFragment,SettingsFragment。

解决方法
当系统尝试恢复页面时,让MainActivity通过三个Fragment实例的tag来重新find到已经实例化的fragment,oncreate()修正的代码如下:

···
 //umeng api
        MobclickAgent.updateOnlineConfig(this);
        UmengUpdateAgent.setUpdateOnlyWifi(false);
        UmengUpdateAgent.update(this);

        if (getIntent().getBooleanExtra(Constant.ACCOUNT_CONFLICT, false) && !isConflictDialogShow) {
            showConflictDialog();
        } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) {
            showAccountRemovedDialog();
        }

        inviteMessgeDao = new InviteMessgeDao(this);
        userDao = new UserDao(this);
        fragments = new Fragment[3];
        if (savedInstanceState == null) {
            conversationListFragment = new ConversationListFragment();
            contactListFragment = new ContactListFragment();
            settingFragment = new SettingsFragment();
            getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, conversationListFragment, "switcher:" + 0)
                    .add(R.id.fragment_container, contactListFragment, "switcher:" + 1).hide(contactListFragment).show(conversationListFragment)
                    .commit();
        } else {
            conversationListFragment = (ConversationListFragment) getSupportFragmentManager().findFragmentByTag("switcher:" + 0);
            contactListFragment = (ContactListFragment) getSupportFragmentManager().findFragmentByTag("switcher:" + 1);
            settingFragment = (SettingsFragment) getSupportFragmentManager().findFragmentByTag("switcher:" + 2);
            if (conversationListFragment == null) {
                conversationListFragment = new ConversationListFragment();
                getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, conversationListFragment, "switcher:" + 0);
            }

            if (contactListFragment == null) {
                contactListFragment = new ContactListFragment();
                getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, contactListFragment, "switcher:" + 1);
            }

            if (settingFragment == null) {
                settingFragment = new SettingsFragment();
                getSupportFragmentManager().beginTransaction().hide(contactListFragment).show(conversationListFragment)
                        .commit();
            } else {
                getSupportFragmentManager().beginTransaction().hide(contactListFragment).hide(settingFragment).show(conversationListFragment)
                        .commit();
            }
        }
        fragments[0] = conversationListFragment;
        fragments[1] = contactListFragment;
        fragments[2] = settingFragment;

        //注册local广播接收者,用于接收demohelper中发出的群组联系人的变动通知
        registerBroadcastReceiver();


        EMClient.getInstance().contactManager().setContactListener(new MyContactListener());
        //内部测试方法,请忽略
        registerInternalDebugReceiver();

        EMLog.d(TAG, "width:" + getScreenWidth(this) + "  height:" + getScreenHeight(this));
···

onTabClicked(View view)方法修正如下:

···
if (currentTabIndex != index) {
            FragmentTransaction trx = getSupportFragmentManager().beginTransaction();
            trx.hide(fragments[currentTabIndex]);
            if (!fragments[index].isAdded()) {
                trx.add(R.id.fragment_container, fragments[index], "switcher:" + index);
            }
            trx.show(fragments[index]).commit();
        }
···

over

Demo在StartServiceReceiver中启动了一个服务EMChatService,导致总是崩溃,需要使用前台服务去启动吗?

java.lang.RuntimeException:Unable to start receiver .ease.receiver.StartServiceReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.hyphenate.chat.EMChatService (has extras) }: app is in background uid UidRecord{604ec63 u0a185 SVC idle procs:2 proclist:16170,16244, seq(0,0,0)}

可以直接把这个StartServiceReceiver 给去掉吗?

Crash on Android 6.0

java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.xxx.xxx-1/lib/arm/libhyphenate_av.so: has text relocations
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.hyphenate.chat.EMClient.loadLibrary(Unknown Source)
at com.hyphenate.chat.EMClient.getInstance(Unknown Source)

依赖缺失

app/build.gradle 里包含 implementation project(':easeui')
但是项目里却没有easeui, 总不能还要单独去另一个仓库下载?

退出登录成功之后,还能获取到当前的用户名?代码如下,222能打印出最后一次登录的账号!按照我的理解,这个打印出来应该是空的

EMClient.getInstance().logout(true, new EMCallBack() {

        @Override
        public void onSuccess() {
            Log.e("111","退出成功");
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    String currentUser = EMClient.getInstance().getCurrentUser();
                    Log.e("222","currentUser:"+ currentUser);
                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            LogUtils.e("退出失败");
        }
    });

注册时出现错误:code : 208 ,description : Registration failed.

注册时出现错误:code : 208 ,description : Registration failed.

注册模式:选择的是 开放注册
图片

注册代码写在IO线程中
GlobalScope.launch(Dispatchers.Main) {
try {
withContext(Dispatchers.IO) {
LogUtils.d("当前线程: ${Thread.currentThread().name} ")
EMUtils.getInstance().createAccount(userName, passWord)
}
......
} catch (e: HyphenateException) {
LogUtils.e("code : ${e.errorCode} ,description : ${e.description}")
val errorCode = e.errorCode
if (errorCode == EMError.NETWORK_ERROR) {//网络异常
showToastMessage(getString(R.string.network_isnot_available))
} else if (errorCode == EMError.USER_ALREADY_EXIST) {//用户已经存在
showToastMessage(getString(R.string.User_already_exists))
} else if (errorCode == EMError.USER_AUTHENTICATION_FAILED) {//无权限
showToastMessage(getString(R.string.registration_failed_without_permission))
} else if (errorCode == EMError.USER_ILLEGAL_ARGUMENT) {//用户名不合法
showToastMessage(getString(R.string.illegal_user_name))
} else if (errorCode == EMError.EXCEED_SERVICE_LIMIT) {//App用户注册数量已达上限
showToastMessage(getString(R.string.register_exceed_service_limit))
} else {//注册失败
showToastMessage(getString(R.string.Registration_failed))
}
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.