Donal,
Your code seems to be monitoring for changes in Wifi singal level. There
is a way to get broadcast notifications for RSSI changes and make your
code event-driven, that is, efficient.
The default minimum update period (30 minutes) only to updates requested
in your widget's description in the XML file (<appwidget-provider
android:updatePeriodMillis="..."). All other broadcast actions are
delivered as they occur.
To register, add this in your manifest file:
<receiver android:name="blah" android:label="@string/widget_name">
<intent-filter>
.....
<action android:name="android.net.wifi.RSSI_CHANGED" />
......
Then in your widget's java file:
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
String action = intent.getAction();
if (action.equals(WifiManager.RSSI_CHANGED_ACTION))
{
int nNewSignalLevel =
intent.getExtraInt(WifiManager.EXTRA_NEW_RSSI, -1);
if (nNewSignalLevel != -1) {
........
........
}
}
31.05.2010 13:18, Donal Rafferty пишет:
I have implemented the widget with the following code:
--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en