本文整理汇总了C#中Android.Content.Intent.GetBundleExtra方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.GetBundleExtra方法的具体用法?C# Intent.GetBundleExtra怎么用?C# Intent.GetBundleExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.GetBundleExtra方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNotification
private void CreateNotification(Intent intent) {
recipe = Recipe.FromBundle(intent.GetBundleExtra(Constants.ExtraRecipe));
List<Notification> notificationPages = new List<Notification> ();
int stepCount = recipe.RecipeSteps.Count;
for (int i = 0; i < stepCount; i++) {
Recipe.RecipeStep recipeStep = recipe.RecipeSteps [i];
var style = new NotificationCompat.BigTextStyle ();
style.BigText (recipeStep.StepText);
style.SetBigContentTitle (String.Format (Resources.GetString (Resource.String.step_count), i + 1, stepCount));
style.SetSummaryText ("");
var builder = new NotificationCompat.Builder (this);
builder.SetStyle (style);
notificationPages.Add (builder.Build ());
}
var notifBuilder = new NotificationCompat.Builder(this);
if (recipe.RecipeImage != null) {
Bitmap recipeImage = Bitmap.CreateScaledBitmap(
AssetUtils.LoadBitmapAsset(this, recipe.RecipeImage),
Constants.NotificationImageWidth, Constants.NotificationImageHeight, false);
notifBuilder.SetLargeIcon(recipeImage);
}
notifBuilder.SetContentTitle (recipe.TitleText);
notifBuilder.SetContentText (recipe.SummaryText);
notifBuilder.SetSmallIcon (Resource.Mipmap.ic_notification_recipe);
Notification notification = notifBuilder.Extend(new NotificationCompat.WearableExtender().AddPages(notificationPages)).Build();
notificationManager.Notify (Constants.NotificationId, notification);
}
示例2: OnReceive
public override void OnReceive (Context context, Intent intent)
{
PendingResult result = GoAsync ();
// If app restriction settings are already created, they will be included in the Bundle
// as key/value pairs.
Bundle existingRestrictions = intent.GetBundleExtra (Intent.ExtraRestrictionsBundle);
Log.Info (TAG, "existingRestrictions = " + existingRestrictions);
Thread thread = new Thread (new ThreadStart (delegate {
CreateRestrictions (context, result, existingRestrictions);
}));
thread.Start ();
}
示例3: HandleIntent
private void HandleIntent(Intent intent)
{
if (intent.Action.Equals(Intent.ActionSearch)) {
var query = intent.GetStringExtra(SearchManager.Query);
Toast.MakeText(this, query, ToastLength.Short).Show();
if (this.T1 != null) {
this.T1.Text = query;
}
var bundle = intent.GetBundleExtra(SearchManager.AppData);
if (bundle != null) {
var key1 = bundle.GetBoolean("Key1");
var key2 = bundle.GetBoolean("Key2");
}
}
}
示例4: OnReceive
public override void OnReceive(Context context, Intent intent)
{
var pluginPackage = intent.GetStringExtra(Strings.ExtraSender);
if (new PluginDatabase(context).IsValidAccessToken(pluginPackage,
intent.GetStringExtra(Strings.ExtraAccessToken),
Strings.ScopeCurrentEntry))
{
if (intent.GetStringExtra(Strings.ExtraEntryId) != _activity.Entry.Uuid.ToHexString())
{
Kp2aLog.Log("received action for wrong entry " + intent.GetStringExtra(Strings.ExtraEntryId));
return;
}
_activity.AddPluginAction(pluginPackage,
intent.GetStringExtra(Strings.ExtraFieldId),
intent.GetStringExtra(Strings.ExtraActionId),
intent.GetStringExtra(Strings.ExtraActionDisplayText),
intent.GetIntExtra(Strings.ExtraActionIconResId, -1),
intent.GetBundleExtra(Strings.ExtraActionData));
}
else
{
Kp2aLog.Log("received invalid request. Plugin not authorized.");
}
}