本文整理汇总了Java中android.app.PendingIntent.send方法的典型用法代码示例。如果您正苦于以下问题:Java PendingIntent.send方法的具体用法?Java PendingIntent.send怎么用?Java PendingIntent.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.PendingIntent
的用法示例。
在下文中一共展示了PendingIntent.send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 打开通知栏消息
*/
private void openNotify(AccessibilityEvent event) {
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
Notification notification = (Notification) event.getParcelableData();
if (notification == null) {
return;
}
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
if (mHandler == null) {
mHandler = new MHandler();
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
clickMoneyAndKey();
}
}, 200);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例2: sendNotifacationReply
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 拉起微信界面
* @param event
*/
private void sendNotifacationReply(AccessibilityEvent event) {
hasAction = true;
if (event.getParcelableData() != null
&& event.getParcelableData() instanceof Notification) {
Notification notification = (Notification) event
.getParcelableData();
String content = notification.tickerText.toString();
String[] cc = content.split(":");
name = cc[0].trim();
scontent = cc[1].trim();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
示例3: onReceive
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case Installer.ACTION_INSTALL_STARTED:
break;
case Installer.ACTION_INSTALL_COMPLETE:
localBroadcastManager.unregisterReceiver(this);
showRelevantView(true);
break;
case Installer.ACTION_INSTALL_INTERRUPTED:
localBroadcastManager.unregisterReceiver(this);
// TODO: handle errors!
break;
case Installer.ACTION_INSTALL_USER_INTERACTION:
PendingIntent installPendingIntent =
intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI);
try {
installPendingIntent.send();
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "PI canceled", e);
}
break;
default:
throw new RuntimeException("intent action not handled!");
}
}
示例4: openNotification
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 打开通知栏消息
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openNotification(AccessibilityEvent event) {
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
//以下是精华,将微信的通知栏消息打开
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例5: launchAppForMessage
import android.app.PendingIntent; //导入方法依赖的package包/类
public void launchAppForMessage(Message message, AppLaunchMethod launchedFrom) {
App app = getAppById(message.getAppId());
PendingIntent pendingIntent = message.getPendingIntent();
if (pendingIntent != null) {
try {
pendingIntent.send();
return;
} catch (CanceledException e) {
Log.d(TAG, "Failed to launch pending intent because it was cancelled");
}
}
Intent launchIntent = app.getLaunchIntentForMessage(message);
if (launchIntent != null) {
launchIntent.addFlags(268435456);
safeStartActivity(launchIntent);
}
}
示例6: openNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
/** 打开通知栏消息*/
private void openNotify(AccessibilityEvent event) {
if(event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例7: openNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
/** 打开通知栏消息 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openNotify(AccessibilityEvent event)
{
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification))
{
return;
}
// 将微信的通知栏消息打开
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try
{
pendingIntent.send();
} catch (PendingIntent.CanceledException e)
{
e.printStackTrace();
}
}
示例8: openNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
/** 打开通知栏消息*/
private void openNotify(AccessibilityEvent event)
{
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification))
{
return;
}
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try
{
pendingIntent.send();
}
catch (PendingIntent.CanceledException e)
{
e.printStackTrace();
}
}
示例9: onHandleIntent
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(@Nullable Intent intent) {
Log.i(TAG, "onhandleIntent: ");
final PendingIntent pi = intent.getParcelableExtra(Constants.PI_KEY);
final Integer first = intent.getIntExtra(Constants.FIRST_KEY, 0);
final Integer second = intent.getIntExtra(Constants.SECOND_KEY, 0);
try {
Integer result = first + second;
TimeUnit.SECONDS.sleep(5);
Intent resultIntent = new Intent().putExtra(Constants.RESULT_KEY, result);
pi.send(CalcIntentService.this, Constants.SERVICE_RESULT, resultIntent);
} catch (InterruptedException | PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例10: startSessionActivity
import android.app.PendingIntent; //导入方法依赖的package包/类
private void startSessionActivity(MediaControllerCompat mediaController) {
PendingIntent intent = mediaController.getSessionActivity();
if (intent != null) {
try {
intent.send();
return;
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
Log.e(TAG, e.toString());
}
}
Log.w(TAG, "Failed to open app by session activity.");
}
示例11: sendNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
public static void sendNotify(AccessibilityEvent event) {
List<CharSequence> texts = event.getText();
if (!texts.isEmpty()) {
String message = texts.get(0).toString();
//过滤微信内部通知消息
if (isInside(message)) {
return;
}
//模拟打开通知栏消息
if (event.getParcelableData() != null && event.getParcelableData() instanceof Notification) {
Log.i("demo", "标题栏canReply=true");
try {
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
}
示例12: onClickStartTestApk
import android.app.PendingIntent; //导入方法依赖的package包/类
public void onClickStartTestApk(View v) {
Log.i("onClickStartTestApk", "Yay I was clicked.");
mFullName.setText("Start Test Apk button pushed!");
if (intents.containsKey("gov.nasa.arc.irg.test_guest_science_apk")) {
PendingIntent start_apk_intent = intents.get("gov.nasa.arc.irg.test_guest_science_apk");
try {
start_apk_intent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
} else {
Log.e("MainActivity", "Couldn't start test gs apk since we don't have a pending intent.");
}
}
示例13: onConnectionFailed
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult result) {
LOGD(TAG, "onConnectionFailed() reached, error code: " + result.getErrorCode()
+ ", reason: " + result.toString());
disconnectDevice(mDestroyOnDisconnect, false /* clearPersistentConnectionData */,
false /* setDefaultRoute */);
mConnectionSuspended = false;
if (mMediaRouter != null) {
mMediaRouter.selectRoute(mMediaRouter.getDefaultRoute());
}
for (BaseCastConsumer consumer : mBaseCastConsumers) {
consumer.onConnectionFailed(result);
}
PendingIntent pendingIntent = result.getResolution();
if (pendingIntent != null) {
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
LOGE(TAG, "Failed to show recovery from the recoverable error", e);
}
}
}
示例14: sendNotifacationReply
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
*
* @param event
*/
private void sendNotifacationReply(AccessibilityEvent event)
{
hasAction = true;
if (event.getParcelableData() != null
&& event.getParcelableData() instanceof Notification)
{
Notification notification = (Notification) event
.getParcelableData();
String content = notification.tickerText.toString();
String[] cc = content.split(":");
name = cc[0].trim();
scontent = cc[1].trim();
// android.util.Log.i("maptrix", "sender name =" + name);
// android.util.Log.i("maptrix", "sender content =" + scontent);
PendingIntent pendingIntent = notification.contentIntent;
try
{
pendingIntent.send();
}
catch (PendingIntent.CanceledException e)
{
e.printStackTrace();
}
}
}
示例15: launchPendingIntent
import android.app.PendingIntent; //导入方法依赖的package包/类
public void launchPendingIntent(PendingIntent pendingIntent) {
if (pendingIntent != null) {
try {
pendingIntent.send();
} catch (CanceledException e) {
Log.d(TAG, "Failed to launch pending intent because it was cancelled");
}
}
}