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


Java SessionAlarmService类代码示例

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


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

示例1: onDataChanged

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    LOGD(TAG, "onDataChanged: " + dataEvents + " for " + getPackageName());

    for (DataEvent event : dataEvents) {
        LOGD(TAG, "Uri is: " + event.getDataItem().getUri());
        DataMapItem mapItem = DataMapItem.fromDataItem(event.getDataItem());
        String path = event.getDataItem().getUri().getPath();
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            if (PATH_RESPONSE.equals(path)) {
                // we have a response
                DataMap data = mapItem.getDataMap();
                saveFeedback(data);
            }
        } else if (event.getType() == DataEvent.TYPE_DELETED) {
            if (path.startsWith(SessionAlarmService.PATH_FEEDBACK)) {
                Uri uri = event.getDataItem().getUri();
                dismissLocalNotification(uri.getLastPathSegment());
            }
        }
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:23,代码来源:FeedbackWearableListenerService.java

示例2: doUserDataSync

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
/**
 * Checks if there are changes on User's Data to sync with/from remote AppData folder.
 *
 * @return Whether or not data was changed.
 * @throws IOException if there is a problem uploading the data.
 */
private boolean doUserDataSync(String accountName) throws IOException {
    if (!isOnline()) {
        LOGD(TAG, "Not attempting userdata sync because device is OFFLINE");
        return false;
    }

    LOGD(TAG, "Starting user data sync.");

    AbstractUserDataSyncHelper helper = UserDataSyncHelperFactory.buildSyncHelper(
            mContext, accountName);
    boolean modified = helper.sync();
    if (modified) {
        // Schedule notifications for the starred sessions.
        Intent scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_ALL_STARRED_BLOCKS,
                null, mContext, SessionAlarmService.class);
        mContext.startService(scheduleIntent);
    }
    return modified;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:27,代码来源:SyncHelper.java

示例3: run

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
@Override
public void run(final Context context, final Callback callback) {
    final String sessionId = SessionAlarmService.DEBUG_SESSION_ID;
    final String sessionTitle = "Debugging with Placeholder Text";
    final String sessionRoom = "Room 1";
    final String sessionSpeaker = "Lauren Ipsum";

    Intent intent = new Intent(
            SessionAlarmService.ACTION_NOTIFY_SESSION_FEEDBACK,
            null, context, SessionAlarmService.class);
    intent.putExtra(SessionAlarmService.EXTRA_SESSION_ID, sessionId);
    intent.putExtra(SessionAlarmService.EXTRA_SESSION_START, System.currentTimeMillis()
            - 30 * 60 * 1000);
    intent.putExtra(SessionAlarmService.EXTRA_SESSION_END, System.currentTimeMillis());
    intent.putExtra(SessionAlarmService.EXTRA_SESSION_TITLE, sessionTitle);
    intent.putExtra(SessionAlarmService.EXTRA_SESSION_ROOM, sessionRoom);
    intent.putExtra(SessionAlarmService.EXTRA_SESSION_SPEAKERS, sessionSpeaker);
    context.startService(intent);
    Toast.makeText(context, "Showing debug session feedback notification.", Toast.LENGTH_LONG).show();
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:21,代码来源:ShowFeedbackNotificationAction.java

示例4: doUserScheduleSync

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
/**
 * Checks if there are changes on MySchedule to sync with/from remote AppData folder.
 *
 * @return Whether or not data was changed.
 * @throws IOException if there is a problem uploading the data.
 */
private boolean doUserScheduleSync(String accountName) throws IOException {
    if (!isOnline()) {
        LOGD(TAG, "Not attempting myschedule sync because device is OFFLINE");
        return false;
    }

    LOGD(TAG, "Starting user data (myschedule) sync.");

    AbstractUserDataSyncHelper helper = UserDataSyncHelperFactory.buildSyncHelper(
            mContext, accountName);
    boolean modified = helper.sync();
    if (modified) {
        // schedule notifications for the starred sessions
        Intent scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_ALL_STARRED_BLOCKS,
                null, mContext, SessionAlarmService.class);
        mContext.startService(scheduleIntent);
    }
    return modified;
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:27,代码来源:SyncHelper.java

示例5: onReceive

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    Intent scheduleIntent = new Intent(
            SessionAlarmService.ACTION_SCHEDULE_ALL_STARRED_BLOCKS,
            null, context, SessionAlarmService.class);
    context.startService(scheduleIntent);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:8,代码来源:SessionAlarmReceiver.java

示例6: run

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
@Override
public void run(Context context, Callback callback) {
    Intent intent = new Intent(
            SessionAlarmService.ACTION_SCHEDULE_ALL_STARRED_BLOCKS,
            null, context, SessionAlarmService.class);
    context.startService(intent);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:8,代码来源:ScheduleStarredSessionAlarmsAction.java

示例7: onStartCommand

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        String action = intent.getAction();
        if (SessionAlarmService.ACTION_NOTIFICATION_DISMISSAL.equals(action)) {
            String sessionId = intent.getStringExtra(SessionAlarmService.KEY_SESSION_ID);
            LOGD(TAG, "onStartCommand(): Action = ACTION_NOTIFICATION_DISMISSAL Session: "
                    + sessionId);
            dismissWearableNotification(sessionId);
        }
    }
    return Service.START_NOT_STICKY;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:13,代码来源:FeedbackWearableListenerService.java

示例8: dismissFeedbackNotification

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
/**
 * Invokes the {@link FeedbackWearableListenerService} to dismiss the notification on both the device
 * and wear.
 */
private void dismissFeedbackNotification(String sessionId) {
    Intent dismissalIntent = new Intent(mContext, FeedbackWearableListenerService.class);
    dismissalIntent.setAction(SessionAlarmService.ACTION_NOTIFICATION_DISMISSAL);
    dismissalIntent.putExtra(SessionAlarmService.KEY_SESSION_ID, sessionId);
    mContext.startService(dismissalIntent);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:11,代码来源:FeedbackHelper.java

示例9: setUpNotification

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
private void setUpNotification() {
    Intent scheduleIntent;

    // Schedule session notification
    if (!hasSessionStarted()) {
        LOGD(TAG, "Scheduling notification about session start.");
        scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_STARRED_BLOCK,
                null, mContext, SessionAlarmService.class);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_START, mSessionStart);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_END, mSessionEnd);
        mContext.startService(scheduleIntent);
    } else {
        LOGD(TAG, "Not scheduling notification about session start, too late.");
    }

    // Schedule feedback notification
    if (!hasSessionEnded()) {
        LOGD(TAG, "Scheduling notification about session feedback.");
        scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_FEEDBACK_NOTIFICATION,
                null, mContext, SessionAlarmService.class);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_ID, mSessionId);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_START, mSessionStart);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_END, mSessionEnd);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_TITLE, mTitle);
        mContext.startService(scheduleIntent);
    } else {
        LOGD(TAG, "Not scheduling feedback notification, too late.");
    }
}
 
开发者ID:silicon-mountain,项目名称:smconf-android,代码行数:32,代码来源:SessionDetailModel.java

示例10: setupNotification

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
private void setupNotification() {
    Intent scheduleIntent;

    // Schedule session notification
    if (UIUtils.getCurrentTime(this) < mSessionStart) {
        LOGD(TAG, "Scheduling notification about session start.");
        scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_STARRED_BLOCK,
                null, this, SessionAlarmService.class);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_START, mSessionStart);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_END, mSessionEnd);
        startService(scheduleIntent);
    } else {
        LOGD(TAG, "Not scheduling notification about session start, too late.");
    }

    // Schedule feedback notification
    if (UIUtils.getCurrentTime(this) < mSessionEnd) {
        LOGD(TAG, "Scheduling notification about session feedback.");
        scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_FEEDBACK_NOTIFICATION,
                null, this, SessionAlarmService.class);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_ID, mSessionId);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_START, mSessionStart);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_END, mSessionEnd);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_TITLE, mTitleString);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_ROOM, mRoomName);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_SPEAKERS, mSpeakers);
        startService(scheduleIntent);
    } else {
        LOGD(TAG, "Not scheduling feedback notification, too late.");
    }
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:34,代码来源:SessionDetailActivity.java

示例11: dismissFeedbackNotification

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
/**
 * Invokes the action {@link SessionAlarmService#ACTION_NOTIFICATION_DISMISSAL} which should
 * result in removal of the notification associated with the given session, which, in turn,
 * should result in removal of the corresponding notifications on both ends.
 */
public static void dismissFeedbackNotification(Context context, String sessionId) {
    Intent dismissalIntent = new Intent(context, FeedbackListenerService.class);
    dismissalIntent.setAction(SessionAlarmService.ACTION_NOTIFICATION_DISMISSAL);
    dismissalIntent.putExtra(SessionAlarmService.KEY_SESSION_ID, sessionId);
    context.startService(dismissalIntent);
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:12,代码来源:FeedbackUtils.java

示例12: onReceive

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if (SessionCalendarService.ACTION_UPDATE_ALL_SESSIONS_CALENDAR_COMPLETED.equals(action)
            || Intent.ACTION_BOOT_COMPLETED.equals(action)) {
        Intent scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_ALL_STARRED_BLOCKS,
                null, context, SessionAlarmService.class);
        context.startService(scheduleIntent);
    }
}
 
开发者ID:google,项目名称:iosched,代码行数:12,代码来源:SessionAlarmReceiver.java

示例13: doUserDataSync

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
/**
 * Checks if there are changes on User's Data to sync with/from remote AppData folder.
 *
 * @return Whether or not data was changed.
 * @throws IOException if there is a problem uploading the data.
 */
private boolean doUserDataSync(SyncResult syncResult) throws IOException {
    if (!ConnectivityUtils.isConnected(mContext)) {
        LOGD(TAG, "Not attempting userdata sync because device is OFFLINE");
        return false;
    }

    String accountName = AccountUtils.getActiveAccountName(mContext);
    if (TextUtils.isEmpty(accountName)) {
        LOGD(TAG, "Not attempting userdata sync because user is not signed in");
        return false;
    }

    LOGD(TAG, "Starting user data sync.");

    AbstractUserDataSyncHelper helper = UserDataSyncHelperFactory.buildSyncHelper(
            mContext, accountName);
    boolean modified = helper.sync();

    if (modified) {
        // Schedule notifications for the starred sessions.
        Intent scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_ALL_STARRED_BLOCKS,
                null, mContext, SessionAlarmService.class);
        mContext.startService(scheduleIntent);
    }
    syncResult.stats.numIoExceptions += helper.getIoExcpetions();
    return modified;
}
 
开发者ID:google,项目名称:iosched,代码行数:35,代码来源:SyncHelper.java

示例14: dismissLocalNotification

import com.google.samples.apps.iosched.service.SessionAlarmService; //导入依赖的package包/类
/**
 * Dismisses the local notification for the given session
 */
private void dismissLocalNotification(String sessionId) {
    LOGD(TAG, "dismissLocalNotification: sessionId=" + sessionId);
    NotificationManagerCompat.from(this)
            .cancel(sessionId, SessionAlarmService.FEEDBACK_NOTIFICATION_ID);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:9,代码来源:FeedbackWearableListenerService.java


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