【问题标题】:Can cwac-locpoll use multiple location providers?cwac-locpoll 可以使用多个位置提供程序吗?
【发布时间】:2012-11-23 15:30:05
【问题描述】:

Android 库cwac-locpoll 使用哪些位置提供程序来查找位置? 它是否仅限于 GPS,还是也可以使用其他来源?

【问题讨论】:

    标签: android commonsware-cwac


    【解决方案1】:

    引用the documentation:

    [LocationPollerIntent] 应该有另一个额外的,由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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 2013-09-26
      • 2013-02-14
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      相关资源
      最近更新 更多