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


Java Notification类代码示例

本文整理汇总了Java中com.sonyericsson.extras.liveware.aef.notification.Notification的典型用法代码示例。如果您正苦于以下问题:Java Notification类的具体用法?Java Notification怎么用?Java Notification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: handleNotificationIntent

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Handle notification intent.
 *
 * @param intent The intent to handle.
 */
private final void handleNotificationIntent(final Intent intent) {
    String action = intent.getAction();

    if (!mExtensionKey.equals(intent.getStringExtra(Notification.Intents.EXTRA_EXTENSION_KEY))) {
        if (Dbg.DEBUG) {
            Dbg.w("Invalid extension key: "
                    + intent.getStringExtra(Notification.Intents.EXTRA_EXTENSION_KEY));
        }
        return;
    }

    if (Notification.Intents.VIEW_EVENT_INTENT.equals(action)) {
        onViewEvent(intent);
    } else if (Notification.Intents.REFRESH_REQUEST_INTENT.equals(action)) {
        onRefreshRequest();
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:23,代码来源:ExtensionService.java

示例2: getEventsWhere

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Get where string that limits a queries to {@link Notification.Event#URI}
 * to affect events that belongs to this extension only
 *
 * @param context The context
 * @return The where string:
 *         <p>
 *         Template: sourceId IN ( sourceId1, sourceId2, ... )
 */
public static String getEventsWhere(Context context) {
    ArrayList<Long> sourceIds = getSourceIds(context);
    if (sourceIds.size() == 0) {
        return "0";
    }
    // Build where clause
    StringBuilder whereBuilder = new StringBuilder();
    whereBuilder.append(Notification.EventColumns.SOURCE_ID + " IN ( ");
    for (int i = 0; i < sourceIds.size() - 1; i++) {
        whereBuilder.append(sourceIds.get(i) + ", ");
    }
    whereBuilder.append(sourceIds.get(sourceIds.size() - 1));
    whereBuilder.append(" )");
    return whereBuilder.toString();
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:25,代码来源:NotificationUtil.java

示例3: handleNotificationIntent

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Handle notification intent.
 *
 * @param intent The intent to handle.
 */
private final void handleNotificationIntent(final Intent intent) {
    String action = intent.getAction();

    if (!getExtensionKey().equals(
            intent.getStringExtra(Notification.Intents.EXTRA_EXTENSION_KEY))) {
        if (Dbg.DEBUG) {
            Dbg.w("Invalid extension key: "
                    + intent.getStringExtra(Notification.Intents.EXTRA_EXTENSION_KEY));
        }
        return;
    }

    if (Notification.Intents.VIEW_EVENT_INTENT.equals(action)) {
        onViewEvent(intent);
    } else if (Notification.Intents.REFRESH_REQUEST_INTENT.equals(action)) {
        onRefreshRequest();
    }
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:24,代码来源:ExtensionService.java

示例4: onRequest

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
@Override
public boolean onRequest(final Intent request, final Intent response) {
    String notificationId = getNotificationId(request);

    if (notificationId == null || notificationId.equals("")) {
        MessageUtils.setInvalidRequestParameterError(response, "notificationId is not specified.");
        return true;
    }
    Uri event = Uri.withAppendedPath(Notification.Event.URI, notificationId);
    int num = getContext().getContentResolver().delete(event, null, null);
    if (num > 0) {
        setResult(response, DConnectMessage.RESULT_OK);
    } else {
        MessageUtils.setInvalidRequestParameterError(response,
            "No notification event is found to be deleted: " + event);
    }
    return true;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:19,代码来源:SWNotificationProfile.java

示例5: onViewEvent

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
@Override
protected void onViewEvent(Intent intent) {
    String action = intent.getStringExtra(Notification.Intents.EXTRA_ACTION);
    String hostAppPackageName = intent
            .getStringExtra(Registration.Intents.EXTRA_AHA_PACKAGE_NAME);
    boolean advancedFeaturesSupported = DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(
            this, hostAppPackageName);

    int eventId = intent.getIntExtra(Notification.Intents.EXTRA_EVENT_ID, -1);
    if (Notification.SourceColumns.ACTION_1.equals(action)) {
        NotificationUtil.deleteAllEvents(this);
    } else if (Notification.SourceColumns.ACTION_2.equals(action)) {
        NotificationUtil.deleteAllEvents(this);
    } else if (Notification.SourceColumns.ACTION_3.equals(action)) {
        Toast.makeText(this, "Action 3", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:grimpy,项目名称:Botifier,代码行数:18,代码来源:SWExtensionService.java

示例6: handleNotificationIntent

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Handle notification intent.
 *
 * @param intent The intent to handle.
 */
private void handleNotificationIntent(final Intent intent) {
  String action = intent.getAction();

  if (!mExtensionKey.equals(intent.getStringExtra(Notification.Intents.EXTRA_EXTENSION_KEY))) {
    if (Dbg.DEBUG) {
      Dbg.w("Invalid extension key: "
            + intent.getStringExtra(Notification.Intents.EXTRA_EXTENSION_KEY));
    }
    return;
  }

  if (Notification.Intents.VIEW_EVENT_INTENT.equals(action)) {
    onViewEvent(intent);
  } else if (Notification.Intents.REFRESH_REQUEST_INTENT.equals(action)) {
    onRefreshRequest();
  }
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:23,代码来源:ExtensionService.java

示例7: getEventsWhere

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Get where string that limits a queries to {@link Notification.Event#URI}
 * to affect events that belongs to this extension only
 *
 * @param context The context
 * @return The where string:
 * <p>
 * Template: sourceId IN ( sourceId1, sourceId2, ... )
 */
public static String getEventsWhere(Context context) {
  ArrayList<Long> sourceIds = getSourceIds(context);
  if (sourceIds.size() == 0) {
    return "0";
  }
  // Build where clause
  StringBuilder whereBuilder = new StringBuilder();
  whereBuilder.append(Notification.EventColumns.SOURCE_ID + " IN ( ");
  for (int i = 0; i < sourceIds.size() - 1; i++) {
    whereBuilder.append(sourceIds.get(i)).append(", ");
  }
  whereBuilder.append(sourceIds.get(sourceIds.size() - 1));
  whereBuilder.append(" )");
  return whereBuilder.toString();
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:25,代码来源:NotificationUtil.java

示例8: registerOrUpdateSources

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Register or update source. This method is called from the the background
 *
 * @param extensionSpecificId The source type to register.
 * @throws RegisterExtensionException
 */
private void registerOrUpdateSources() throws RegisterExtensionException {
    ArrayList<String> oldExtensionSpecificIds = NotificationUtil
            .getExtensionSpecificIds(mContext);

    for (ContentValues sourceConfiguration : mRegistrationInformation
            .getSourceRegistrationConfigurations()) {
        String extensionSpecificId = (String)sourceConfiguration
                .get(Notification.SourceColumns.EXTENSION_SPECIFIC_ID);
        // If we find the source id in the database then we have already
        // registered.
        long sourceId = NotificationUtil.getSourceId(mContext, extensionSpecificId);

        // Package name is not required but many of the SDK utility
        // methods are dependent of the package name.
        sourceConfiguration.put(SourceColumns.PACKAGE_NAME, mContext.getPackageName());

        if (sourceId == NotificationUtil.INVALID_ID) {
            sourceId = registerSource(sourceConfiguration);
        } else {
            updateSource(sourceConfiguration, sourceId);
        }
        if (Dbg.DEBUG) {
            Dbg.d("SourceType:" + extensionSpecificId + " SourceId:" + sourceId);
        }

        oldExtensionSpecificIds.remove(extensionSpecificId);
    }

    // Remove any sources that are no longer used.
    for (String deletedExtensionSpecificId : oldExtensionSpecificIds) {
        unregisterSource(deletedExtensionSpecificId);
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:40,代码来源:RegisterExtensionTask.java

示例9: onStartRefresh

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Start refreshing the widget. The widget is now visible.
 */
@Override
public void onStartRefresh() {
    // Start observing the event table to get notified when new events
    // arrive.
    mEventContentObserver = new EventContentObserver(mHandler);
    mContext.getContentResolver().registerContentObserver(Notification.Event.URI, true,
            mEventContentObserver);

    // Widget just started. Update image.
    updateWidget(false);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:15,代码来源:NotificationWidgetExtension.java

示例10: getEventCursor

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Get the event cursor for most relevant event, defined as: the event with
 * the lowest PUBLISHED_TIME with PUBLISHED_TIME > current time. If no such
 * event choose the event with highest PUBLISHED_TIME.
 *
 * @return The event cursor for the event
 */
protected Cursor getEventCursor() {
    Cursor cursor = null;
    long now = System.currentTimeMillis();

    cursor = NotificationUtil.queryEventsFromEnabledSources(mContext, EVENT_PROJECTION,
            Notification.EventColumns.PUBLISHED_TIME + ">" + now, null,
            Notification.EventColumns.PUBLISHED_TIME + " asc limit 1");

    if (cursor == null || !cursor.moveToFirst()) {
        if (cursor != null) {
            cursor.close();
        }
        cursor = NotificationUtil.queryEventsFromEnabledSources(mContext, EVENT_PROJECTION,
                null, null, Notification.EventColumns.PUBLISHED_TIME + " desc limit 1");
        if (cursor == null) {
            return null;
        }
        if (!cursor.moveToFirst()) {
            cursor.close();
            return null;
        }

    }

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

示例11: registerOrUpdateSources

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Register or update source. This method is called from the the background
 *
 * @param extensionSpecificId The source type to register.
 * @throws RegisterExtensionException
 */
private void registerOrUpdateSources() throws RegisterExtensionException {
    ArrayList<String> oldExtensionSpecificIds = NotificationUtil
            .getExtensionSpecificIds(mContext);

    for (ContentValues sourceConfiguration : mRegistrationInformation
            .getSourceRegistrationConfigurations()) {
        String extensionSpecificId = (String) sourceConfiguration
                .get(Notification.SourceColumns.EXTENSION_SPECIFIC_ID);
        // If we find the source id in the database then we have already
        // registered.
        long sourceId = NotificationUtil.getSourceId(mContext, extensionSpecificId);

        // Package name is not required but many of the SDK utility
        // methods are dependent of the package name.
        sourceConfiguration.put(SourceColumns.PACKAGE_NAME, mContext.getPackageName());

        if (sourceId == NotificationUtil.INVALID_ID) {
            sourceId = registerSource(sourceConfiguration);
        } else {
            updateSource(sourceConfiguration, sourceId);
        }
        if (Dbg.DEBUG) {
            Dbg.d("SourceType:" + extensionSpecificId + " SourceId:" + sourceId);
        }

        oldExtensionSpecificIds.remove(extensionSpecificId);
    }

    // Remove any sources that are no longer used.
    for (String deletedExtensionSpecificId : oldExtensionSpecificIds) {
        unregisterSource(deletedExtensionSpecificId);
    }
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:40,代码来源:RegistrationHelper.java

示例12: getSourceRegistrationConfiguration

import com.sonyericsson.extras.liveware.aef.notification.Notification; //导入依赖的package包/类
/**
 * Returns the properties of a source.
 *
 * @param extensionSpecificId The id of the extension to associate the source
 * with.
 * @return The source configuration.
 */
public ContentValues getSourceRegistrationConfiguration(final String extensionSpecificId) {
    ContentValues sourceValues = new ContentValues();
    sourceValues.put(Notification.SourceColumns.ENABLED, true);
    sourceValues.put(Notification.SourceColumns.UPDATE_TIME, System.currentTimeMillis());
    sourceValues.put(Notification.SourceColumns.NAME, "Notification source");
    sourceValues.put(Notification.SourceColumns.EXTENSION_SPECIFIC_ID, extensionSpecificId);
    sourceValues.put(Notification.SourceColumns.PACKAGE_NAME, mContext.getPackageName());
    return sourceValues;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:17,代码来源:SWExtensionRegistrationInformation.java


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