~lsgadmins/+junk/lsgapp-trunk

« back to all changes in this revision

Viewing changes to src/com/lsg/app/UpdateBroadcastReceiver.java

  • Committer: maximilian
  • Date: 2012-05-10 19:03:45 UTC
  • Revision ID: maximilian-20120510190345-xjp6t5sohqzwnnhl
*seperated again
*new front page navigation
*now using AsyncTask for update

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import android.content.BroadcastReceiver;
4
4
import android.content.Context;
5
5
import android.content.Intent;
6
 
import android.os.Handler;
7
 
import android.os.Looper;
8
 
import android.os.Message;
9
6
import android.util.Log;
10
7
 
11
8
public class UpdateBroadcastReceiver extends BroadcastReceiver {
12
 
        public static class ProgressThread extends Thread {
 
9
        /*public static class ProgressThread extends Thread {
13
10
                Handler handler;
14
11
                Context context;
15
12
                boolean notify;
25
22
                        }
26
23
                public void run() {
27
24
                        Looper.prepare();
28
 
                        boolean update = Functions.refreshVPlan(context, handler, notify);
 
25
                        //boolean update = Functions.refreshVPlan(context, handler, notify);
29
26
                        
30
27
                        Message msg = handler.obtainMessage();
31
28
                        msg.arg1 = 3;
56
53
                        
57
54
                        msg = handler.obtainMessage();
58
55
                        msg.arg1 = 1;
59
 
                        if(!update)
 
56
                        /*if(!update)
60
57
                                msg.arg1 = 2;
61
58
                        handler.sendMessage(msg);
62
59
                        }
63
 
                }
 
60
                }*/
 
61
        public static class VPupdate extends Thread {
 
62
                Context context;
 
63
                VPupdate(Context c) {
 
64
                        context = c;
 
65
                }
 
66
                public void run() {
 
67
                        VPlan.VPlanUpdater vpup = new VPlan.VPlanUpdater(context);
 
68
                        String res[] = vpup.update();
 
69
                        Log.d(res[0], res[1]);
 
70
                }
 
71
        }
64
72
        private static class IDSender extends Thread {
65
73
                Context context;
66
74
                String registration_id;
92
100
                }
93
101
        private void updateVP(Context context) {
94
102
                Log.d("UpdateBroadcastReceiver", "update VPlan");
95
 
                Handler h = new Handler();
96
 
                ProgressThread progress = new ProgressThread(h, context, false);
97
 
                progress.start();
 
103
                VPupdate vp = new VPupdate(context);
 
104
                vp.start();
98
105
        }
99
106
        private void handleRegistration(Context context, Intent intent) {
100
107
                    String registration = intent.getStringExtra("registration_id");