2012-07-30 3 views
1

나는 안드로이드 프로그래밍에 초보자입니다. 신호 레벨, 운영자 세부 정보와 같은 네트워크 상태를 업데이트하는 위젯을 만들고 싶습니다. 이 데이터를 1 초 간격으로 업데이트 할 수 있습니까? 위젯에서 가능합니다. 그렇다면 친절하게 해결책을 제공해주십시오.
감사합니다.는 android widget에 도움이 필요합니다

+1

것은이 http://developer.android.com 도움이됩니다 /guide/topics/appwidgets/index.html 솔루션에 대한 –

답변

1

android:updatePeriodMillis은 최소 30 분으로 제한되어 있기 때문에이 작업을 기본적으로 수행 할 수 없습니다.

당신은 (지원 간격으로 30 분 미만 않음) 알람 관리기에 위젯 업데이트하는 서비스를 추가하여이 제한을 무시할 수

:

final Intent _intent = new Intent(context, MyUpdateService.class); 
final PendingIntent pending = PendingIntent.getService(context, 0, _intent, 0); 
final AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); 
alarm.cancel(pending); 
long interval = 60000; 
alarm.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(),interval, pending) 
+0

감사합니다. – Riskhan

관련 문제