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


Java PendingIntent.getActivities方法代码示例

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


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

示例1: NotificationItem

import android.app.PendingIntent; //导入方法依赖的package包/类
private NotificationItem(int id, String title, String desc) {
    super(id, title, desc);
    Intent[] intents = new Intent[2];
    intents[0] = Intent.makeMainActivity(new ComponentName(DemoApplication.CONTEXT,
            MainActivity.class));
    intents[1] = new Intent(DemoApplication.CONTEXT, NotificationSampleActivity.class);

    this.pendingIntent = PendingIntent.getActivities(DemoApplication.CONTEXT, 0, intents,
            PendingIntent.FLAG_UPDATE_CURRENT);

    builder = new NotificationCompat.
            Builder(FileDownloadHelper.getAppContext());

    builder.setDefaults(Notification.DEFAULT_LIGHTS)
            .setOngoing(true)
            .setPriority(NotificationCompat.PRIORITY_MIN)
            .setContentTitle(getTitle())
            .setContentText(desc)
            .setContentIntent(pendingIntent)
            .setSmallIcon(R.mipmap.ic_launcher);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:NotificationMinSetActivity.java

示例2: showNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
private void showNotification(String title, String message) {
    Intent notifyIntent = new Intent(this, MainActivity.class);
    notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivities(this, 0,
            new Intent[] { notifyIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
    Notification notification = new Notification.Builder(this)
            .setSmallIcon(android.R.drawable.ic_dialog_info)
            .setContentTitle(title)
            .setContentText(message)
            .setAutoCancel(true)
            .setContentIntent(pendingIntent)
            .build();
    notification.defaults |= Notification.DEFAULT_SOUND;
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(1, notification);
}
 
开发者ID:bjaanes,项目名称:BeaconMqtt,代码行数:18,代码来源:BeaconApplication.java

示例3: createNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
/**
 * Creates the notification
 * 
 * @param messageResId
 *            message resource id. The message must have one String parameter,<br />
 *            f.e. <code>&lt;string name="name"&gt;%s is connected&lt;/string&gt;</code>
 * @param defaults
 *            signals that will be used to notify the user
 */
private void createNotification(final int messageResId, final int defaults) {
	final Intent parentIntent = new Intent(this, FeaturesActivity.class);
	parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	final Intent targetIntent = new Intent(this, HTSActivity.class);

	final Intent disconnect = new Intent(ACTION_DISCONNECT);
	final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);

	// both activities above have launchMode="singleTask" in the AndroidManifest.xml file, so if the task is already running, it will be resumed
	final PendingIntent pendingIntent = PendingIntent.getActivities(this, OPEN_ACTIVITY_REQ, new Intent[] { parentIntent, targetIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
	final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
	builder.setContentIntent(pendingIntent);
	builder.setContentTitle(getString(R.string.app_name)).setContentText(getString(messageResId, getDeviceName()));
	builder.setSmallIcon(R.drawable.ic_stat_notify_hts);
	builder.setShowWhen(defaults != 0).setDefaults(defaults).setAutoCancel(true).setOngoing(true);
	builder.addAction(new NotificationCompat.Action(R.drawable.ic_action_bluetooth, getString(R.string.hts_notification_action_disconnect), disconnectAction));

	final Notification notification = builder.build();
	final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
	nm.notify(NOTIFICATION_ID, notification);
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:31,代码来源:HTSService.java

示例4: createNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
/**
 * Creates the notification
 * 
 * @param messageResId
 *            message resource id. The message must have one String parameter,<br />
 *            f.e. <code>&lt;string name="name"&gt;%s is connected&lt;/string&gt;</code>
 * @param defaults
 *            signals that will be used to notify the user
 */
private void createNotification(final int messageResId, final int defaults) {
	final Intent parentIntent = new Intent(this, FeaturesActivity.class);
	parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	final Intent targetIntent = new Intent(this, RSCActivity.class);

	final Intent disconnect = new Intent(ACTION_DISCONNECT);
	final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);

	// both activities above have launchMode="singleTask" in the AndroidManifest.xml file, so if the task is already running, it will be resumed
	final PendingIntent pendingIntent = PendingIntent.getActivities(this, OPEN_ACTIVITY_REQ, new Intent[] { parentIntent, targetIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
	final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
	builder.setContentIntent(pendingIntent);
	builder.setContentTitle(getString(R.string.app_name)).setContentText(getString(messageResId, getDeviceName()));
	builder.setSmallIcon(R.drawable.ic_stat_notify_rsc);
	builder.setShowWhen(defaults != 0).setDefaults(defaults).setAutoCancel(true).setOngoing(true);
	builder.addAction(new NotificationCompat.Action(R.drawable.ic_action_bluetooth, getString(R.string.rsc_notification_action_disconnect), disconnectAction));

	final Notification notification = builder.build();
	final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
	nm.notify(NOTIFICATION_ID, notification);
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:31,代码来源:RSCService.java

示例5: createNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
/**
 * Creates the notification
 * 
 * @param messageResId
 *            message resource id. The message must have one String parameter,<br />
 *            f.e. <code>&lt;string name="name"&gt;%s is connected&lt;/string&gt;</code>
 * @param defaults
 *            signals that will be used to notify the user
 */
private void createNotification(final int messageResId, final int defaults) {
	final Intent parentIntent = new Intent(this, FeaturesActivity.class);
	parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	final Intent targetIntent = new Intent(this, UARTActivity.class);

	final Intent disconnect = new Intent(ACTION_DISCONNECT);
	disconnect.putExtra(EXTRA_SOURCE, SOURCE_NOTIFICATION);
	final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);

	// both activities above have launchMode="singleTask" in the AndroidManifest.xml file, so if the task is already running, it will be resumed
	final PendingIntent pendingIntent = PendingIntent.getActivities(this, OPEN_ACTIVITY_REQ, new Intent[] { parentIntent, targetIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
	final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
	builder.setContentIntent(pendingIntent);
	builder.setContentTitle(getString(R.string.app_name)).setContentText(getString(messageResId, getDeviceName()));
	builder.setSmallIcon(R.drawable.ic_stat_notify_uart);
	builder.setShowWhen(defaults != 0).setDefaults(defaults).setAutoCancel(true).setOngoing(true);
	builder.addAction(new NotificationCompat.Action(R.drawable.ic_action_bluetooth, getString(R.string.uart_notification_action_disconnect), disconnectAction));

	final Notification notification = builder.build();
	final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
	nm.notify(NOTIFICATION_ID, notification);
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:32,代码来源:UARTService.java

示例6: createNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
/**
 * Creates the notification
 * 
 * @param messageResId
 *            message resource id. The message must have one String parameter,<br />
 *            f.e. <code>&lt;string name="name"&gt;%s is connected&lt;/string&gt;</code>
 * @param defaults
 *            signals that will be used to notify the user
 */
private void createNotification(final int messageResId, final int defaults) {
	final Intent parentIntent = new Intent(this, FeaturesActivity.class);
	parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	final Intent targetIntent = new Intent(this, TemplateActivity.class);

	final Intent disconnect = new Intent(ACTION_DISCONNECT);
	final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);

	// both activities above have launchMode="singleTask" in the AndroidManifest.xml file, so if the task is already running, it will be resumed
	final PendingIntent pendingIntent = PendingIntent.getActivities(this, OPEN_ACTIVITY_REQ, new Intent[] { parentIntent, targetIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
	final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
	builder.setContentIntent(pendingIntent);
	builder.setContentTitle(getString(R.string.app_name)).setContentText(getString(messageResId, getDeviceName()));
	builder.setSmallIcon(R.drawable.ic_stat_notify_template);
	builder.setShowWhen(defaults != 0).setDefaults(defaults).setAutoCancel(true).setOngoing(true);
	builder.addAction(new NotificationCompat.Action(R.drawable.ic_action_bluetooth, getString(R.string.template_notification_action_disconnect), disconnectAction));

	final Notification notification = builder.build();
	final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
	nm.notify(NOTIFICATION_ID, notification);
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:31,代码来源:TemplateService.java

示例7: createNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
/**
 * Creates the notification
 * 
 * @param messageResId
 *            the message resource id. The message must have one String parameter,<br />
 *            f.e. <code>&lt;string name="name"&gt;%s is connected&lt;/string&gt;</code>
 * @param defaults
 *            signals that will be used to notify the user
 */
private void createNotification(final int messageResId, final int defaults) {
	final Intent parentIntent = new Intent(this, FeaturesActivity.class);
	parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	final Intent targetIntent = new Intent(this, CSCActivity.class);

	final Intent disconnect = new Intent(ACTION_DISCONNECT);
	final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);

	// both activities above have launchMode="singleTask" in the AndroidManifest.xml file, so if the task is already running, it will be resumed
	final PendingIntent pendingIntent = PendingIntent.getActivities(this, OPEN_ACTIVITY_REQ, new Intent[] { parentIntent, targetIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
	final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
	builder.setContentIntent(pendingIntent);
	builder.setContentTitle(getString(R.string.app_name)).setContentText(getString(messageResId, getDeviceName()));
	builder.setSmallIcon(R.drawable.ic_stat_notify_csc);
	builder.setShowWhen(defaults != 0).setDefaults(defaults).setAutoCancel(true).setOngoing(true);
	builder.addAction(new NotificationCompat.Action(R.drawable.ic_action_bluetooth, getString(R.string.csc_notification_action_disconnect), disconnectAction));

	final Notification notification = builder.build();
	final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
	nm.notify(NOTIFICATION_ID, notification);
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:31,代码来源:CSCService.java

示例8: activitiesContent

import android.app.PendingIntent; //导入方法依赖的package包/类
public NotificationCenter activitiesContent (Intent[] its) {
    if (mOptions != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mPi = PendingIntent.getActivities(mCenter.getContext(), mReqCode, its, mFlags, mOptions);
    } else {
        mPi = PendingIntent.getActivities(mCenter.getContext(), mReqCode, its, mFlags);
    }
    mCenter.contentIntent(mPi);
    return mCenter;
}
 
开发者ID:boybeak,项目名称:NotificationStyles,代码行数:10,代码来源:PendingIt.java

示例9: activitiesDelete

import android.app.PendingIntent; //导入方法依赖的package包/类
public NotificationCenter activitiesDelete (Intent[] its) {
    if (mOptions != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mPi = PendingIntent.getActivities(mCenter.getContext(), mReqCode, its, mFlags, mOptions);
    } else {
        mPi = PendingIntent.getActivities(mCenter.getContext(), mReqCode, its, mFlags);
    }
    mCenter.deleteIntent(mPi);
    return mCenter;
}
 
开发者ID:boybeak,项目名称:NotificationStyles,代码行数:10,代码来源:PendingIt.java

示例10: sendNotification

import android.app.PendingIntent; //导入方法依赖的package包/类
private void sendNotification(String notificationTitle, String notificationBody, Bitmap bitmap, Intent intent, Intent backIntent) {
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    PendingIntent pendingIntent;

    if(backIntent != null) {
        backIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        Intent[] intents = new Intent[] {backIntent, intent};
        pendingIntent = PendingIntent.getActivities(this, notificationId++, intents, PendingIntent.FLAG_ONE_SHOT);
    } else {
        pendingIntent = PendingIntent.getActivity(this, notificationId++, intent, PendingIntent.FLAG_ONE_SHOT);
    }

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
            .setAutoCancel(true)   //Automatically delete the notification
            .setSmallIcon(R.drawable.ic_push_notification_small) //Notification icon
            .setContentIntent(pendingIntent)
            .setContentTitle(notificationTitle)
            .setContentText(notificationBody)
            .setLargeIcon(bitmap)
            .setSound(defaultSoundUri);


    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(notificationId++ /* ID of notification */, notificationBuilder.build());
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:29,代码来源:MyFirebaseMessagingService.java

示例11: getActivitiesPendingIntent

import android.app.PendingIntent; //导入方法依赖的package包/类
public static PendingIntent getActivitiesPendingIntent(Context context, int requestCode, Intent[] intents, int flags) {
    return PendingIntent.getActivities(context, requestCode, intents, flags);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:TaskStackBuilderHoneycomb.java

示例12: getActivitiesPendingIntent

import android.app.PendingIntent; //导入方法依赖的package包/类
public static PendingIntent getActivitiesPendingIntent(Context context, int requestCode, Intent[] intents, int flags, Bundle options) {
    return PendingIntent.getActivities(context, requestCode, intents, flags, options);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:TaskStackBuilderJellybean.java


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