當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript BackgroundGeolocation.isPowerSaveMode方法代碼示例

本文整理匯總了TypeScript中nativescript-background-geolocation-lt.BackgroundGeolocation.isPowerSaveMode方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BackgroundGeolocation.isPowerSaveMode方法的具體用法?TypeScript BackgroundGeolocation.isPowerSaveMode怎麽用?TypeScript BackgroundGeolocation.isPowerSaveMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nativescript-background-geolocation-lt.BackgroundGeolocation的用法示例。


在下文中一共展示了BackgroundGeolocation.isPowerSaveMode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  constructor() {
    super();

    // First listen to desired events:
    BackgroundGeolocation.on("location", (location) => {
      console.log('[event] location: ', location);
      this.location = JSON.stringify(location, null, 2);
    });
    BackgroundGeolocation.on("motionchange", (isMoving:boolean, location:any) => {
      console.log('[motionchange] -', isMoving, location);
    });
    BackgroundGeolocation.on('http', (response) => {
      console.log('[http] -', response.status, response.responseText);
    });
    BackgroundGeolocation.on('providerchange', (provider) => {
      console.log('[providerchange] -', provider);
    });
    BackgroundGeolocation.on('powersavechange', (isPowerSaveMode) => {
      console.log('[powersavechange] -', isPowerSaveMode);
    });
    BackgroundGeolocation.on('schedule', (state) => {
      console.log('[schedule] -', state.enabled);
    });
    BackgroundGeolocation.on('activitychange', (event) => {
      console.log('[eveactivitychangent] -', event.activity, event.confidence);
    });
    BackgroundGeolocation.on('heartbeat', (event) => {
      console.log('[heartbeat] -', event);
    });
    BackgroundGeolocation.on('geofence', (geofence) => {
      console.log('[geofence] -', geofence);      
    });
    BackgroundGeolocation.on('geofenceschange', (event) => {
      console.log('[geofenceschange] - ON:', JSON.stringify(event.on), ', OFF:', JSON.stringify(event.off));
    });
    BackgroundGeolocation.on('connectivitychange', (event) => {
      console.log('[connectivitychange] -', event);
    });
    BackgroundGeolocation.on('enabledchange', (event) => {
      console.log('[enabledchange] - ', event);
    });
    BackgroundGeolocation.getSensors((sensors) => {
      console.log('[getSensors] -', JSON.stringify(sensors, null, 2));
    });
    BackgroundGeolocation.isPowerSaveMode((mode) => {
      console.log('[isPowerSaveMode] -', mode);
    });
    
    // Now configure the plugin.
    BackgroundGeolocation.ready({
      reset: true,
      debug: true, 
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 50,
      stopTimeout: 1,      
      autoSync: true,
      stopOnTerminate: false,
      startOnBoot: true,
      foregroundService: true,
      heartbeatInterval: 60,
      username: 'transistor-ns',
      enableHeadless: true
    }, (state) => {
      console.log('[ready] success -', state);
      this.paceButtonIcon = (state.isMoving) ? ICONS.pause : ICONS.play;
      this.enabled = state.enabled;
    }, (error:string) => {
      console.warn('[ready] FAILURE -', error);
    });
  }
開發者ID:transistorsoft,項目名稱:nativescript-background-geolocation-lt,代碼行數:71,代碼來源:main-view-model.ts


注:本文中的nativescript-background-geolocation-lt.BackgroundGeolocation.isPowerSaveMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。