本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}