No Network Connectivity in Service/AlarmManager Process.

by Mark Murphy » Thu, 25 Mar 2010 07:52:18 GMT


Sponsored Links
 


That looks strange.

-- WifiLock is managed by WifiManager, which is not a PowerManager.

-- WifiManager has a createWifiLock() method to create the WifiLock, not
a newWakeLock() method

Also, I'm not sure this is necessarily going to work if you are locking
and unlocking at the time you are doing the WakeLocks. If your goal is
for WiFi to be available immediately upon the alarm, you will need to
use a WifiLock to keep WiFi active back when you schedule the alarm. To
quote from the WifiLock documentation:

"Normally the Wi-Fi radio may turn off when the user has not used the
device in a while. Acquiring a WifiLock will keep the radio on until the
lock is released. Multiple applications may hold WifiLocks, and the
radio will only be allowed to turn off when no WifiLocks are held in any
application."

If this is something that's supposed to be going on 24x7, since keeping
the WiFi radio on all that time will drain the battery pretty good, I
think you're more going to need to just hang tight in your
doWakefulWork() until WiFi connectivity is restored.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training in NYC: 10-11 April 2010:  http://guruloft.com 

--



No Network Connectivity in Service/AlarmManager Process.

by Mark Murphy » Thu, 25 Mar 2010 08:33:31 GMT


 


Then grab a stronger WakeLock, I guess.


Actually, it pretty much works as the name suggests.


Probably there is, but perhaps a partial WakeLock is insufficient.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training in US: 14-18 June 2010:  http://bignerdranch.com 

--


Sponsored Links


No Network Connectivity in Service/AlarmManager Process.

by Mark Murphy » Sat, 27 Mar 2010 21:31:44 GMT


 


Like I said, I am not aware of any such limitation. As I wrote, the only
times I know of when alarms get nuked are:

-- on a reboot, all alarms go "poof!"

-- if the user has a so-called "task killer" app and kills your app that
way, your alarms go "poof!" (though alarms from other un-killed apps
remain in place)

Conversely, there are places in Android itself where AlarmManager is
used from an Activity -- alarm clock and calendar, to name two.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to Android Development_ Version 3.0
Available!

--



Other Threads

1. Android 1.0 Porting problem

Hi,

I am porting android 1.o to my linux arm-based phone. After the screen
showing "android init", below strace logs began repeating in the
console. Even the text of "android init" dispeared, the below logs
kept repeating. And the phone went to the blank&dark screen and can
not get to main desktop screen.

Thank you for any help or suggestions from the group.

android_power_suspend: exit suspend, ret = -19
android_power_suspend: pm_suspend returned with no event
android_power_suspend: enter suspend
android_power_suspend: exit suspend, ret = -19
android_power_suspend: pm_suspend returned with no event
android_power_suspend: enter suspend
android_power_suspend: exit suspend, ret = -19
android_power_suspend: pm_suspend returned with no event
android_power_suspend: enter suspend
android_power_suspend: exit suspend, ret = -19
android_power_suspend: pm_suspend returned with no event
[{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}],
3, 5000) = 0 <5.006646>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 880801775}) = 0
<0.000061>
00:02:29 stat64("/system/bin/dbus-daemon", {st_mode=S_IFREG|0755,
st_size=121728, ...}) = 0 <0.000091>
00:02:29 fork()                         = 183 <0.000427>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 891624775}) = 0
<0.000092>
00:02:29 futex(0x40003420, FUTEX_WAKE, 2147483647) = 0 <0.000092>
00:02:29 futex(0x40001004, FUTEX_WAKE, 2147483647) = 0 <0.000060>
00:02:29 poll([{fd=4, events=POLLIN, revents=POLLIN}, {fd=6,
events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 <0.000092>
00:02:29 recvfrom(4, "add@/kernel/uids/1002\0ACTION=add"..., 1024, 0,
NULL, NULL) = 85 <0.000091>
00:02:29 recvfrom(4, 0xbe98c8b2, 1024, 0, 0, 0) = -1 EAGAIN (Resource
temporarily unavailable) <0.000061>
00:02:29 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8,
events=POLLIN}], 3, -1) = ? ERESTART_RESTARTBLOCK (To be restarted)
<0.002378>
00:02:29 --- SIGCHLD (Child exited) @ 0 (0) ---
00:02:29 write(7, "\21", 1)             = 1 <0.000092>
00:02:29 sigreturn()                    = ? (mask now []) <0.000061>
00:02:29 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8,
events=POLLIN, revents=POLLIN}], 3, -1) = 1 <0.000091>
00:02:29 read(8, "\21", 92)             = 1 <0.000092>
00:02:29 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG,
NULL) = 183 <0.000122>
00:02:29 kill(-183, SIGKILL)            = -1 ESRCH (No such process)
<0.000122>
00:02:29 unlink("/dev/socket/dbus")     = 0 <0.000122>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 900984775}) = 0
<0.000091>
00:02:29 futex(0x40003420, FUTEX_WAKE, 2147483647) = 0 <0.000061>
00:02:29 futex(0x40001004, FUTEX_WAKE, 2147483647) = 0 <0.000061>
00:02:29 wait4(-1, 0xbe98cc30, WNOHANG, NULL) = 0 <0.000061>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 902569775}) = 0
<0.000091>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 902935775}) = 0
<0.000061>
00:02:29 poll([{fd=4, events=POLLIN, revents=POLLIN}, {fd=6,
events=POLLIN}, {fd=8, events=POLLIN}], 3, 5000) = 1 <0.028019>
00:02:29 recvfrom(4, "remove@/kernel/uids/1002\0ACTION="..., 1024, 0,
NULL, NULL) = 91 <0.000092>
00:02:29 recvfrom(4, 0xbe98c8b2, 1024, 0, 0, 0) = -1 EAGAIN (Resource
temporarily unavailable) <0.000061>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 932813775}) = 0
<0.000061>
00:02:29 clock_gettime(CLOCK_MONOTONIC, {142, 933210775}) = 0
<0.000061>
--~--~---------~--~----~------------~-------~--~----~

2. Correct usage of getNetworkInfo(int networkType)

Hey all,

     reading google documentation about NetworkInfo class, i found the
method

public NetworkInfo  getNetworkInfo(int networkType) ;

This will be very usefull for me, to get info about the network.

 but there is no documentation about this method. I'm trying to get
the network info, doing

NetworkInfo netInfo = new
NetworkInfo(ConnectivityManager.TYPE_MOBILE);

ConnectivityManager  connManager =
(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

netInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);


Actually, I'm capable to get those information usign

String extra_info;
extra_info = "" +
intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);

But, when running this piece of code, in Android Screen appear that
error "Sorry application (software) is not responding" and in LogCat
no info about this. When debugging, an error appear "Source not
found". What is the correct usage of this method?

thanks a lot

Breno
--~--~---------~--~----~------------~-------~--~----~

3. question about layout.xml and View class

4. Text color in GridView

5. Improved support for camera on Android emulator.

6. Download counts frozen

7. chatterbean