0
点赞
收藏
分享

微信扫一扫

linphone-BootReceiver.java文件分析


说明

这是个在android发送开机广播的时候调用的类

功能

主要就是为了在开机的时候启动LinphoneService开启后台服务。其中有一个.linphonerc的文件,这个文件应该是LpConfig的对应的配置文件。如果有错请更正。

BootReceiver.java

public class BootReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {

                String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc";
                LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);
                if (lpConfig.getBool("app", "auto_start", false)) {
                        Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
                        lLinphoneServiceIntent.setClass(context, LinphoneService.class);
                        context.startService(lLinphoneServiceIntent);
                }
        }
}


举报

相关推荐

0 条评论