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


Java RemoteInput.getResultsFromIntent方法代码示例

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


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

示例1: onReceive

import android.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
	// Get remote input
	Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
	// Exit if remote input is null (always true for API < 24)
	if (remoteInput == null) {
		return;
	}
	// Get reply text
	String reply = remoteInput.getString(KEY_TEXT_REPLY);
	// Create reply notification
	Notification replyNotification =
			new Notification.Builder(context)
					.setSmallIcon(R.drawable.ic_notifications_active_black_24dp)
					.setContentTitle("Reply received!")
					.setContentText(reply)
					.build();
	// Send reply notification
	NotificationManager notificationManager =
			(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
	notificationManager.notify(REPLY_NOTIFICATION_ID, replyNotification);
}
 
开发者ID:hkosacki,项目名称:discover-android-n,代码行数:23,代码来源:ReplyBroadcastReceiver.java

示例2: getNotificationReply

import android.app.RemoteInput; //导入方法依赖的package包/类
@Nullable
static String getNotificationReply(Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        // RemoteInput was added in KITKAT_WATCH.
        if (intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_REPLY) != null) {
            // If the notification click went through the job scheduler, we will have set
            // the reply as a standard string extra.
            return intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_REPLY);
        }
        Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
        if (remoteInputResults != null) {
            CharSequence reply =
                    remoteInputResults.getCharSequence(NotificationConstants.KEY_TEXT_REPLY);
            if (reply != null) {
                return reply.toString();
            }
        }
    }
    return null;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:21,代码来源:NotificationPlatformBridge.java

示例3: getNotificationReply

import android.app.RemoteInput; //导入方法依赖的package包/类
@Nullable
private static String getNotificationReply(Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        // RemoteInput was added in KITKAT_WATCH.
        Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
        if (remoteInputResults != null) {
            CharSequence reply =
                    remoteInputResults.getCharSequence(NotificationConstants.KEY_TEXT_REPLY);
            if (reply != null) {
                return reply.toString();
            }
        }
    }
    return null;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:NotificationPlatformBridge.java

示例4: onReceive

import android.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    Log.d ( TAG, "onReceive()..." + new Date() ) ;

    String voiceReplyContent = "No reply";

    Bundle remoteInputBundle = RemoteInput.getResultsFromIntent(intent);
    Log.d ( TAG, "onReceive() remoteInputBundle=" + remoteInputBundle ) ;
    if (remoteInputBundle != null) {
         CharSequence charSequence = remoteInputBundle.getCharSequence(EXTRA_VOICE_REPLY) ;
        voiceReplyContent = charSequence.toString() ;
    }

    Log.d ( TAG, "onReceive()... voiceReplyContent=" + voiceReplyContent ) ;

    // originate notification that will end up showing on the handheld
    Notification notification = new Notification.Builder(context)
            .setSmallIcon(R.drawable.alarm36)
            .setContentTitle("From Head unit")
            .setContentText( voiceReplyContent )
            .setColor( context.getResources().getColor(R.color.colorPrimary)).build() ;

    NotificationManager notificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify( 7200, notification );

}
 
开发者ID:smitzey,项目名称:AndroidAutoTourGuide,代码行数:28,代码来源:MessageReplyBroadcastReceiver.java

示例5: onResume

import android.app.RemoteInput; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    if (getIntent() != null) {
        Bundle inputResults = RemoteInput.getResultsFromIntent(getIntent());
        if (inputResults != null) {
            CharSequence replyText = inputResults.getCharSequence(KEY_REPLY);
            if (replyText != null) {
                Toast.makeText(this, TextUtils.concat(getString(R.string.reply_was), replyText),
                        Toast.LENGTH_LONG).show();
            }
        }
    }
}
 
开发者ID:AndroidAvanzato,项目名称:Capitolo6,代码行数:15,代码来源:MainActivity.java

示例6: onCreate

import android.app.RemoteInput; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_voice_input_result);

    tvResult = (TextView) findViewById(R.id.tv_activity_voice_input_result);

    Bundle remoteInput = RemoteInput.getResultsFromIntent(getIntent());
    if(remoteInput!=null){
        CharSequence result = remoteInput.getCharSequence(KEY_VOICE_INPUT);
        tvResult.setText(result);
    }
}
 
开发者ID:kunny,项目名称:notifications-android-L,代码行数:14,代码来源:VoiceInputResultActivity.java

示例7: getResultsFromIntent

import android.app.RemoteInput; //导入方法依赖的package包/类
static Bundle getResultsFromIntent(Intent intent) {
    return RemoteInput.getResultsFromIntent(intent);
}
 
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:4,代码来源:RemoteInputCompatApi20.java

示例8: a

import android.app.RemoteInput; //导入方法依赖的package包/类
public final Bundle a(Intent paramIntent)
{
  return RemoteInput.getResultsFromIntent(paramIntent);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:et.java

示例9: onReceive

import android.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {

    Log.d(TAG, "onReceive()... intent=" + intent) ;

    Bundle remoteVoiceInputBundle =  RemoteInput.getResultsFromIntent(intent) ;

    String voiceInputAsText = null ;

    try {
        voiceInputAsText = remoteVoiceInputBundle.getCharSequence( VOICE_INPUT_KEY).toString() ;
    } catch ( Throwable t) {
        Log.w ( TAG, "onReceive()... throwable/exception=" + t) ;
    }


    Log.d(TAG, "onReceive()... received from Wear device, voiceInputAsText=" + voiceInputAsText) ;

    if ( voiceInputAsText != null ) {
        startActivity ( context, voiceInputAsText ) ;
    }



}
 
开发者ID:smitzey,项目名称:wearbooksource,代码行数:26,代码来源:MyRemoteInputBroadcastReceiver.java

示例10: getResultsFromIntent

import android.app.RemoteInput; //导入方法依赖的package包/类
static Bundle getResultsFromIntent(Intent intent)
{
    return RemoteInput.getResultsFromIntent(intent);
}
 
开发者ID:Hamz-a,项目名称:MyCTFWriteUps,代码行数:5,代码来源:RemoteInputCompatApi20.java


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