Back to project page mitlocate.
The source code is released under:
MIT License
If you think the Android project mitlocate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package edu.mit.locate; //w ww. ja v a2s . c o m import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; public class BootLocationService extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { SharedPreferences prefs = context.getSharedPreferences("MITLOCATE", 0); AlarmManager am = (AlarmManager)context.getSystemService(Service.ALARM_SERVICE); Intent MITLocationServiceIntent = new Intent(context, MITLocationService.class); PendingIntent pi = PendingIntent.getService(context, 1, MITLocationServiceIntent, PendingIntent.FLAG_UPDATE_CURRENT); am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,15*1000,prefs.getInt("ReportingInterval",15)*60*1000,pi); } } }