[英]Javamail Send email work with wifi connection but not with data mobile
I'm new in android. 我是android新手。 I'm learning about javamail to create app that can send email notification.
我正在学习有关javamail的信息,以创建可以发送电子邮件通知的应用程序。 I follow this tutorial https://www.simplifiedcoding.net/android-email-app-using-javamail-api-in-android-studio/
我遵循本教程https://www.simplifiedcoding.net/android-email-app-using-javamail-api-in-android-studio/
It's working well in emulator android. 在模拟器android中运行良好。 I can receive email.
我可以收到电子邮件。 Then I tried to install my app in my android device with Wifi connection, it's working well.
然后,我尝试通过Wifi连接将我的应用安装到我的android设备中,效果很好。 But when I use Data Mobile Connection (not Wifi) email not sent.
但是,当我使用数据移动连接(不是Wifi)时,电子邮件不会发送。 Can you tell me why?
你能告诉我为什么吗?
Thanks for advance. 感谢前进。
solution from @Agung from the comments 来自@Agung的评论解决方案
add this code 添加此代码
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
in AndroidManifest.xml file... 在AndroidManifest.xml文件中...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.