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


Java DetectedActivity.STILL屬性代碼示例

本文整理匯總了Java中com.google.android.gms.location.DetectedActivity.STILL屬性的典型用法代碼示例。如果您正苦於以下問題:Java DetectedActivity.STILL屬性的具體用法?Java DetectedActivity.STILL怎麽用?Java DetectedActivity.STILL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.gms.location.DetectedActivity的用法示例。


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

示例1: getNameFromType

private String getNameFromType(int activityType) {
    switch (activityType) {
        case DetectedActivity.RUNNING:
            return "running";
        case DetectedActivity.IN_VEHICLE:
            return "in_vehicle";
        case DetectedActivity.ON_BICYCLE:
            return "on_bicycle";
        case DetectedActivity.ON_FOOT:
            return "on_foot";
        case DetectedActivity.STILL:
            return "still";
        case DetectedActivity.UNKNOWN:
            return "unknown";
        case DetectedActivity.TILTING:
            return "tilting";
    }
    return "unknown";
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:DetectedActivityToString.java

示例2: onLocationChanged

@Override
public void onLocationChanged(Location location) {
    Log.d(TAG, "onLocationChanged: " + location.toString());

    if (lastActivity.getType() == DetectedActivity.STILL) {
        stopTracking();
    }

    if (config.isDebugging()) {
        Toast.makeText(context, "acy:" + location.getAccuracy() + ",v:" + location.getSpeed() + ",df:" + config.getDistanceFilter(), Toast.LENGTH_LONG).show();
    }

    // if (lastLocation != null && location.distanceTo(lastLocation) < config.getDistanceFilter()) {
    //     return;
    // }

    if (config.isDebugging()) {
        startTone("beep");
    }

    lastLocation = location;
    handleLocation(location);
}
 
開發者ID:QuintechDevOps,項目名稱:cordova-plugin-quintech-background-geolocation,代碼行數:23,代碼來源:ActivityRecognitionLocationProvider.java

示例3: getActivityString

public static String getActivityString(int detectedActivityType) {
      switch(detectedActivityType) {
          case DetectedActivity.IN_VEHICLE:
              return "IN_VEHICLE";
          case DetectedActivity.ON_BICYCLE:
              return "ON_BICYCLE";
          case DetectedActivity.ON_FOOT:
              return "ON_FOOT";
          case DetectedActivity.RUNNING:
              return "RUNNING";
          case DetectedActivity.STILL:
              return "STILL";
          case DetectedActivity.TILTING:
              return "TILTING";
          case DetectedActivity.UNKNOWN:
              return "UNKNOWN";
          case DetectedActivity.WALKING:
              return "WALKING";
          default:
              return "Unknown";
      }
}
 
開發者ID:QuintechDevOps,項目名稱:cordova-plugin-quintech-background-geolocation,代碼行數:22,代碼來源:ActivityRecognitionLocationProvider.java

示例4: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
    ArrayList<DetectedActivity> detectedActivities = (ArrayList) result.getProbableActivities();

    //Find the activity with the highest percentage
    lastActivity = getProbableActivity(detectedActivities);

    Log.d(TAG, "MOST LIKELY ACTIVITY: " + getActivityString(lastActivity.getType()) + " " + lastActivity.getConfidence());

    if (lastActivity.getType() == DetectedActivity.STILL) {
        if (config.isDebugging()) {
            Toast.makeText(context, "Detected STILL Activity", Toast.LENGTH_SHORT).show();
        }
        // stopTracking();
        // we will delay stop tracking after position is found
    } else {
        if (config.isDebugging()) {
            Toast.makeText(context, "Detected ACTIVE Activity", Toast.LENGTH_SHORT).show();
        }
        startTracking();
    }
    //else do nothing
}
 
開發者ID:QuintechDevOps,項目名稱:cordova-plugin-quintech-background-geolocation,代碼行數:24,代碼來源:ActivityRecognitionLocationProvider.java

示例5: getActivityString

/**
 * Returns a human readable String corresponding to a detected activity type.
 */
public static String getActivityString(Context context, int detectedActivityType) {
    Resources resources = context.getResources();
    switch(detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return resources.getString(R.string.in_vehicle);
        case DetectedActivity.ON_BICYCLE:
            return resources.getString(R.string.on_bicycle);
        case DetectedActivity.ON_FOOT:
            return resources.getString(R.string.on_foot);
        case DetectedActivity.RUNNING:
            return resources.getString(R.string.running);
        case DetectedActivity.STILL:
            return resources.getString(R.string.still);
        case DetectedActivity.TILTING:
            return resources.getString(R.string.tilting);
        case DetectedActivity.UNKNOWN:
            return resources.getString(R.string.unknown);
        case DetectedActivity.WALKING:
            return resources.getString(R.string.walking);
        default:
            return resources.getString(R.string.unidentifiable_activity, detectedActivityType);
    }
}
 
開發者ID:maddygy,項目名稱:Activity-Recognition-Tools,代碼行數:26,代碼來源:Constants.java

示例6: getNameFromType

/**
 * Map detected activity types to strings
 *@param activityType The detected activity type
 *@return A user-readable name for the type
 */
private String getNameFromType(int activityType) {
    switch(activityType) {
        case DetectedActivity.IN_VEHICLE:
            return "in_vehicle";
        case DetectedActivity.ON_BICYCLE:
            return "on_bicycle";
        case DetectedActivity.ON_FOOT:
            return "on_foot";
        case DetectedActivity.STILL:
            return "still";
        case DetectedActivity.UNKNOWN:
            return "unknown";
        case DetectedActivity.TILTING:
            return "tilting";
    }
    return "unknown";
}
 
開發者ID:RobertTrebor,項目名稱:CycleFrankfurtAndroid,代碼行數:22,代碼來源:ActivityRecognitionIntentService.java

示例7: getActivityString

public static String getActivityString(int detectedActivityType) {
    switch(detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return "IN_VEHICLE";
        case DetectedActivity.ON_BICYCLE:
            return "ON_BICYCLE";
        case DetectedActivity.ON_FOOT:
            return "ON_FOOT";
        case DetectedActivity.RUNNING:
            return "RUNNING";
        case DetectedActivity.STILL:
            return "STILL";
        case DetectedActivity.TILTING:
            return "TILTING";
        case DetectedActivity.UNKNOWN:
            return "UNKNOWN";
        case DetectedActivity.WALKING:
            return "WALKING";
        default:
            return "UNIDENTIFIABLE";
    }
}
 
開發者ID:Aminoid,項目名稱:react-native-activity-recognition,代碼行數:22,代碼來源:DetectionService.java

示例8: getActivityString

/**
 * Returns a human readable String corresponding to a detected activity type.
 */
static String getActivityString(Context context, int detectedActivityType) {
    Resources resources = context.getResources();
    switch(detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return resources.getString(R.string.in_vehicle);
        case DetectedActivity.ON_BICYCLE:
            return resources.getString(R.string.on_bicycle);
        case DetectedActivity.ON_FOOT:
            return resources.getString(R.string.on_foot);
        case DetectedActivity.RUNNING:
            return resources.getString(R.string.running);
        case DetectedActivity.STILL:
            return resources.getString(R.string.still);
        case DetectedActivity.TILTING:
            return resources.getString(R.string.tilting);
        case DetectedActivity.UNKNOWN:
            return resources.getString(R.string.unknown);
        case DetectedActivity.WALKING:
            return resources.getString(R.string.walking);
        default:
            return resources.getString(R.string.unidentifiable_activity, detectedActivityType);
    }
}
 
開發者ID:JimSeker,項目名稱:googleplayAPI,代碼行數:26,代碼來源:Utils.java

示例9: getActivityString

/**
 * Returns a human readable String corresponding to a detected activity type.
 */

public static String getActivityString(int detectedActivityType) {
    switch (detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return "In a Vehicle";
        case DetectedActivity.ON_BICYCLE:
            return "On a bicycle";
        case DetectedActivity.ON_FOOT:
            return "On Foot";
        case DetectedActivity.RUNNING:
            return "Running";
        case DetectedActivity.STILL:
            return "Still (not moving)";
        case DetectedActivity.TILTING:
            return "Tilting";
        case DetectedActivity.UNKNOWN:
            return "Unknown Activity";
        case DetectedActivity.WALKING:
            return "Walking";
        default:
            return "Unknown Type";
    }
}
 
開發者ID:JimSeker,項目名稱:googleplayAPI,代碼行數:26,代碼來源:MainActivity.java

示例10: getActivityPic

/**
 * Returns a human readable String corresponding to a detected activity type.
 */

public static int getActivityPic(int detectedActivityType) {
    switch (detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return R.drawable.car;
        case DetectedActivity.ON_BICYCLE:
            return R.drawable.bike;
        case DetectedActivity.ON_FOOT:
            return R.drawable.walk;
        case DetectedActivity.RUNNING:
            return R.drawable.run;
        case DetectedActivity.STILL:
            return R.drawable.still;
        case DetectedActivity.TILTING:
            return R.drawable.tilt;
        case DetectedActivity.UNKNOWN:
            return R.drawable.unknown;
        case DetectedActivity.WALKING:
            return R.drawable.walk;
        default:
            return R.drawable.unknown;
    }
}
 
開發者ID:JimSeker,項目名稱:googleplayAPI,代碼行數:26,代碼來源:myAdapter.java

示例11: getActivityString

public static String getActivityString(Context context, int detectedActivityType) {
    Resources resources = context.getResources();
    switch (detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return resources.getString(R.string.in_vehicle);
        case DetectedActivity.ON_BICYCLE:
            return resources.getString(R.string.on_bicycle);
        case DetectedActivity.ON_FOOT:
            return resources.getString(R.string.on_foot);
        case DetectedActivity.RUNNING:
            return resources.getString(R.string.running);
        case DetectedActivity.STILL:
            return resources.getString(R.string.still);
        case DetectedActivity.TILTING:
            return resources.getString(R.string.tilting);
        case DetectedActivity.UNKNOWN:
            return resources.getString(R.string.unknown);
        case DetectedActivity.WALKING:
            return resources.getString(R.string.walking);
        default:
            return resources.getString(R.string.unidentifiable_activity, detectedActivityType);
    }
}
 
開發者ID:jamescoggan,項目名稱:activity-recognition-example,代碼行數:23,代碼來源:Constants.java

示例12: startActivityRecognition

private static void startActivityRecognition(final Context context) {
    if (Util.hasPlayServices(context)) {
        GoogleApiClient gac = new GoogleApiClient.Builder(context).addApi(ActivityRecognition.API).build();
        if (gac.blockingConnect().isSuccess()) {
            Log.i(TAG, "GoogleApiClient connected");
            Intent activityIntent = new Intent(context, BackgroundService.class);
            activityIntent.setAction(BackgroundService.ACTION_ACTIVITY);
            PendingIntent pi = PendingIntent.getService(context, 0, activityIntent, PendingIntent.FLAG_UPDATE_CURRENT);

            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
            boolean still = (prefs.getInt(SettingsFragment.PREF_LAST_ACTIVITY, DetectedActivity.STILL) == DetectedActivity.STILL);
            String setting = (still ? SettingsFragment.PREF_RECOGNITION_INTERVAL_STILL : SettingsFragment.PREF_RECOGNITION_INTERVAL_MOVING);
            String standard = (still ? SettingsFragment.DEFAULT_RECOGNITION_INTERVAL_STILL : SettingsFragment.DEFAULT_RECOGNITION_INTERVAL_MOVING);
            int interval = Integer.parseInt(prefs.getString(setting, standard));

            ActivityRecognition.ActivityRecognitionApi.requestActivityUpdates(gac, interval * 1000, pi);
            Log.i(TAG, "Activity updates frequency=" + interval + "s");
        }
    }
}
 
開發者ID:M66B,項目名稱:BackPackTrackII,代碼行數:20,代碼來源:BackgroundService.java

示例13: getActivityName

public static String getActivityName(int activityType, Context context) {
    switch (activityType) {
        case DetectedActivity.STILL:
            return context.getString(R.string.still);
        case DetectedActivity.TILTING:
            return context.getString(R.string.tilting);
        case DetectedActivity.ON_FOOT:
            return context.getString(R.string.on_foot);
        case DetectedActivity.WALKING:
            return context.getString(R.string.walking);
        case DetectedActivity.RUNNING:
            return context.getString(R.string.running);
        case DetectedActivity.ON_BICYCLE:
            return context.getString(R.string.on_bicycle);
        case DetectedActivity.IN_VEHICLE:
            return context.getString(R.string.in_vehicle);
        case DetectedActivity.UNKNOWN:
            return context.getString(R.string.unknown);
        case -1:
            return context.getString(R.string.motion);
        case -2:
            return context.getString(R.string.displacement);
        default:
            return context.getString(R.string.undefined);
    }
}
 
開發者ID:M66B,項目名稱:BackPackTrackII,代碼行數:26,代碼來源:BackgroundService.java

示例14: onReceive

@Override
public void onReceive(Context context, Intent intent) {
  ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
  ArrayList<DetectedActivity> detectedActivities = (ArrayList) result.getProbableActivities();

  //Find the activity with the highest percentage
  lastActivity = Constants.getProbableActivity(detectedActivities);

  Log.w(TAG, "MOST LIKELY ACTIVITY: " + Constants.getActivityString(lastActivity.getType()) + " " + lastActivity.getConfidence());

  Intent mIntent = new Intent(Constants.CALLBACK_ACTIVITY_UPDATE);
  mIntent.putExtra(Constants.ACTIVITY_EXTRA, detectedActivities);
  getApplicationContext().sendBroadcast(mIntent);
  Log.w(TAG, "Activity is recording" + isRecording);

  if(lastActivity.getType() == DetectedActivity.STILL && isRecording) {
      showDebugToast(context, "Detected Activity was STILL, Stop recording");
      stopRecording();
  } else if(lastActivity.getType() != DetectedActivity.STILL && !isRecording) {
      showDebugToast(context, "Detected Activity was ACTIVE, Start Recording");
      startRecording();
  }
  //else do nothing
}
 
開發者ID:pmwisdom,項目名稱:cordova-background-geolocation-services,代碼行數:24,代碼來源:BackgroundLocationUpdateService.java

示例15: getActivityString

public static String getActivityString(int detectedActivityType) {
    switch(detectedActivityType) {
        case DetectedActivity.IN_VEHICLE:
            return "IN_VEHICLE";
        case DetectedActivity.ON_BICYCLE:
            return "ON_BICYCLE";
        case DetectedActivity.ON_FOOT:
            return "ON_FOOT";
        case DetectedActivity.RUNNING:
            return "RUNNING";
        case DetectedActivity.STILL:
            return "STILL";
        case DetectedActivity.TILTING:
            return "TILTING";
        case DetectedActivity.UNKNOWN:
            return "UNKNOWN";
        case DetectedActivity.WALKING:
            return "WALKING";
        default:
            return "Unknown";
    }
}
 
開發者ID:pmwisdom,項目名稱:cordova-background-geolocation-services,代碼行數:22,代碼來源:Constants.java


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