根据documentation,当我注册一个应用进行位置更新时,使用指定的线程来处理事件,我有以下import { Routes } from '@angular/router';
import { NotFoundComponent } from './utility/not-found.component';
export const appRoutes: Routes = [
{ path: 'NotFound', component: NotFoundComponent },
{ path: '', redirectTo: '/events', pathMatch: 'full' },
{ path: '**', component: NotFoundComponent }
];
的方法:>
LocationManager
但是,当我要注册该设备的其他传感器的事件时,void requestLocationUpdates(long minTime,
float minDistance,
Criteria criteria,
LocationListener listener,
Looper looper)
void requestLocationUpdates(String provider,
long minTime,
float minDistance,
LocationListener listener,
Looper looper)
为我提供了以下方法(source):
SensorManager
据我了解,在两种情况下,指定boolean registerListener(SensorEventListener listener,
Sensor sensor,
int samplingPeriodUs,
Handler handler)
boolean registerListener(SensorEventListener listener,
Sensor sensor,
int samplingPeriodUs,
int maxReportLatencyUs,
Handler handler)
或Looper
的意图是绝对相同的:在指定线程中处理事件。但是,为什么我必须在一种情况下提供Handler
而在另一种情况下提供Looper
?