Implementing Twilio's incoming calling code from activity into Service class but get error each time

喜欢而已 提交于 2019-12-07 00:15:23

So I have solved my problem by just adding a line in Service class

        phone.login(DEFAULT_CLIENT_NAME, true, true);

I always get null in Device and Connection when I call this method via Service.

Of course. Here is your code where you are calling startService() on IncomingCallService:

intent = new Intent(context, IncomingCallService.class);
context.startService(intent);

You will notice that you are not putting any extras on this Intent. Therefore, there will be no extras when you try to pull them out of the Intent delivered to the service in onStartCommand(). If you want extras to be on this Intent, you need to type in the putExtra() calls to do so.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!