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


Java ExtensionUtils.INVALID_ID属性代码示例

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


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

示例1: registerOrUpdateWidgetRegistration

/**
 * Register or update widget registration.
 *
 * @param apiRegistrationId The API registration ID.
 * @param values The content values to register.
 * @return True if the registration was successful.
 */
private boolean registerOrUpdateWidgetRegistration(long apiRegistrationId, ContentValues values) {
    if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
        // Widget registration only possible if Registration API version 3 or later.
        return false;
    }

    values.put(Registration.WidgetRegistrationColumns.API_REGISTRATION_ID, apiRegistrationId);

    long widgetRegistrationId = getWidgetRegistrationId(apiRegistrationId,
            values.getAsString(Registration.WidgetRegistrationColumns.KEY));

    if (widgetRegistrationId != ExtensionUtils.INVALID_ID) {
        return mContext.getContentResolver().update(Registration.WidgetRegistration.URI,
                values, Registration.WidgetRegistrationColumns._ID + " = ?", new String[] {
                    Long.toString(widgetRegistrationId)
                }) > 0;

    } else {
        return mContext.getContentResolver()
                .insert(Registration.WidgetRegistration.URI, values) != null;
    }
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:29,代码来源:RegistrationHelper.java

示例2: getWidgetRegistrationId

/**
 * Get the widget registration id from a widget registration key.
 *
 * @param apiRegistrationId The API registration id.
 * @param key The key.
 * @return The widget registration id.
 */
private long getWidgetRegistrationId(long apiRegistrationId, String key) {
    if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
        // Widget registration only possible if Registration API version 3 or later.
        return ExtensionUtils.INVALID_ID;
    }

    Cursor cursor = null;
    try {
        cursor = mContext.getContentResolver().query(
                Registration.WidgetRegistration.URI,
                new String[] {
                        Registration.WidgetRegistrationColumns._ID
                }
                ,Registration.WidgetRegistrationColumns.API_REGISTRATION_ID + " = ? AND "
                        + Registration.WidgetRegistrationColumns.KEY + " = ?", new String[] {
                        Long.toString(apiRegistrationId), key
                }, null);
        if (cursor != null && cursor.moveToFirst()) {
            return cursor.getLong(cursor.getColumnIndexOrThrow(Registration.WidgetRegistrationColumns._ID));
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }

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

示例3: isRegistered

/**
 * 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,代码行数:8,代码来源:RegisterExtensionTask.java

示例4: isRegistered

/**
 * 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,代码行数:8,代码来源:RegisterExtensionTask.java


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