当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionUtils.getExtensionId方法代码示例

本文整理汇总了Java中com.sonyericsson.extras.liveware.extension.util.ExtensionUtils.getExtensionId方法的典型用法代码示例。如果您正苦于以下问题:Java ExtensionUtils.getExtensionId方法的具体用法?Java ExtensionUtils.getExtensionId怎么用?Java ExtensionUtils.getExtensionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sonyericsson.extras.liveware.extension.util.ExtensionUtils的用法示例。


在下文中一共展示了ExtensionUtils.getExtensionId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isHostAppRegistered

import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入方法依赖的package包/类
/**
 * Checks if the extension is registered with a host application.
 *
 * This method is called from the the background
 *
 * @param packageName The package name of the host application.
 *
 * @return True if the extension is registered with the host application.
 */
private boolean isHostAppRegistered(String packageName) {
    Cursor cursor = null;
    boolean isRegistered = false;
    long extensionId = ExtensionUtils.getExtensionId(mContext);
    String selection = Registration.ApiRegistrationColumns.EXTENSION_ID + " = " + extensionId
            + " AND " + Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE + " = ?";
    String[] selectionArgs = new String[] {
        packageName
    };

    try {
        cursor = mContext.getContentResolver().query(Registration.ApiRegistration.URI,
                new String[] {
                    Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE
                }, selection, selectionArgs, null);
        if (cursor != null) {
            isRegistered = (cursor.getCount() > 0);
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }

    return isRegistered;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:36,代码来源:RegisterExtensionTask.java

示例2: isHostAppRegistered

import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入方法依赖的package包/类
/**
 * Checks if the extension is registered with a host application. This
 * method is called from the the background
 *
 * @param packageName The package name of the host application.
 * @return True if the extension is registered with the host application.
 */
private boolean isHostAppRegistered(String packageName) {
    Cursor cursor = null;
    boolean isRegistered = false;
    long extensionId = ExtensionUtils.getExtensionId(mContext);
    String selection = Registration.ApiRegistrationColumns.EXTENSION_ID + " = " + extensionId
            + " AND " + Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE + " = ?";
    String[] selectionArgs = new String[] {
            packageName
    };

    try {
        cursor = mContext.getContentResolver().query(Registration.ApiRegistration.URI,
                new String[] {
                    Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE
                },
                selection, selectionArgs, null);
        if (cursor != null) {
            isRegistered = (cursor.getCount() > 0);
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }

    return isRegistered;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:35,代码来源:RegistrationHelper.java

示例3: isHostAppRegistered

import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入方法依赖的package包/类
/**
 * Checks if the extension is registered with a host application. This
 * method is called from the the background
 *
 * @param packageName The package name of the host application.
 * @return True if the extension is registered with the host application.
 */
private boolean isHostAppRegistered(String packageName) {
  Cursor cursor = null;
  boolean isRegistered = false;
  long extensionId = ExtensionUtils.getExtensionId(mContext);
  String selection = Registration.ApiRegistrationColumns.EXTENSION_ID + " = " + extensionId
                     + " AND " + Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE + " = ?";
  String[] selectionArgs = new String[] {
    packageName
  };

  try {
    cursor = mContext.getContentResolver().query(Registration.ApiRegistration.URI,
                                                 new String[] {
                                                   Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE
                                                 },
                                                 selection, selectionArgs, null);
    if (cursor != null) {
      isRegistered = (cursor.getCount() > 0);
    }
  } finally {
    if (cursor != null) {
      cursor.close();
    }
  }

  return isRegistered;
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:35,代码来源:RegisterExtensionTask.java

示例4: registerApiRegistration

import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入方法依赖的package包/类
/**
 * Register our extension with a host application. Override this to provide
 * extension specific implementation.
 *
 * This method is called from the the background
 *
 * @param packageName The package name of host application.
 * @param isRegistered true if already registered.
 * @param widgetApiVersionSupported True if widget registration.
 * @param controlApiVersionSupported True if control registration.
 *
 * @return True if registration was successful.
 */
private boolean registerApiRegistration(String packageName, boolean isRegistered,
        boolean widgetApiVersionSupported, boolean controlApiVersionSupported,
        boolean sensorApiVersionSupported) {
    if (Dbg.DEBUG) {
        Dbg.d("Register API registration: " + packageName);
    }
    ContentValues values = new ContentValues();
    values.put(Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE, packageName);
    if (widgetApiVersionSupported) {
        values.put(Registration.ApiRegistrationColumns.WIDGET_API_VERSION,
                mRegistrationInformation.getRequiredWidgetApiVersion());
    } else {
        values.put(Registration.ApiRegistrationColumns.WIDGET_API_VERSION, 0);
    }
    if (controlApiVersionSupported) {
        values.put(Registration.ApiRegistrationColumns.CONTROL_API_VERSION,
                mRegistrationInformation.getRequiredControlApiVersion());
    } else {
        values.put(Registration.ApiRegistrationColumns.CONTROL_API_VERSION, 0);
    }
    if (sensorApiVersionSupported) {
        values.put(Registration.ApiRegistrationColumns.SENSOR_API_VERSION,
                mRegistrationInformation.getRequiredSensorApiVersion());
    } else {
        values.put(Registration.ApiRegistrationColumns.SENSOR_API_VERSION, 0);
    }

    boolean res = false;
    long extensionId = ExtensionUtils.getExtensionId(mContext);
    if (!isRegistered) {
        values.put(Registration.ApiRegistrationColumns.EXTENSION_ID, extensionId);
        Uri uri = mContext.getContentResolver()
                .insert(Registration.ApiRegistration.URI, values);
        res = uri != null;
    } else {
        long _id = ExtensionUtils.getRegistrationId(mContext, packageName);
        int rows = mContext.getContentResolver().update(
                ContentUris.withAppendedId(Registration.ApiRegistration.URI, _id),
                values, null, null);
        res = rows > 0;
    }
    return res;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:57,代码来源:RegisterExtensionTask.java

示例5: isRegistered

import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入方法依赖的package包/类
/**
 * Find out if this extension is registered or not
 *
 * @return True if registered
 */
private boolean isRegistered() {
    return ExtensionUtils.getExtensionId(mContext) != ExtensionUtils.INVALID_ID;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:9,代码来源:RegisterExtensionTask.java

示例6: isRegistered

import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入方法依赖的package包/类
/**
 * Find out if this extension is registered or not
 *
 * @return True if registered
 */
private boolean isRegistered() {
  return ExtensionUtils.getExtensionId(mContext) != ExtensionUtils.INVALID_ID;
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:9,代码来源:RegisterExtensionTask.java


注:本文中的com.sonyericsson.extras.liveware.extension.util.ExtensionUtils.getExtensionId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。