2012-11-23 48 views

回答

1

报价the documentation

[该IntentLocationPoller]应该有另一种多余的,由LocationPoller.EXTRA_PROVIDER键,与您要使用的位置提供者的名称。

的文档中的示例代码示出了这一点:

mgr=(AlarmManager)getSystemService(ALARM_SERVICE); 

Intent i=new Intent(this, LocationPoller.class); 

i.putExtra(LocationPoller.EXTRA_INTENT, 
        new Intent(this, LocationReceiver.class)); 
i.putExtra(LocationPoller.EXTRA_PROVIDER, 
        LocationManager.NETWORK_PROVIDER); 

pi=PendingIntent.getBroadcast(this, 0, i, 0); 
mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 
            SystemClock.elapsedRealtime(), 
            PERIOD, 
            pi); 
相关问题