本文整理汇总了C#中Bundle.KeySet方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.KeySet方法的具体用法?C# Bundle.KeySet怎么用?C# Bundle.KeySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.KeySet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateValuesFromBundle
void UpdateValuesFromBundle (Bundle savedInstanceState)
{
if (savedInstanceState != null) {
if (savedInstanceState.KeySet ().Contains (ADDRESS_REQUESTED_KEY)) {
mAddressRequested = savedInstanceState.GetBoolean (ADDRESS_REQUESTED_KEY);
}
if (savedInstanceState.KeySet ().Contains (LOCATION_ADDRESS_KEY)) {
mAddressOutput = savedInstanceState.GetString (LOCATION_ADDRESS_KEY);
DisplayAddressOutput ();
}
}
}
示例2: UpdateValuesFromBundle
void UpdateValuesFromBundle (Bundle savedInstanceState)
{
if (savedInstanceState != null) {
if (savedInstanceState.KeySet ().Contains (KEY_REQUESTING_LOCATION_UPDATES)) {
mRequestingLocationUpdates = savedInstanceState.GetBoolean (
KEY_REQUESTING_LOCATION_UPDATES);
}
if (savedInstanceState.KeySet ().Contains (KEY_LOCATION)) {
mCurrentLocation = (Location)savedInstanceState.GetParcelable (KEY_LOCATION);
}
if (savedInstanceState.KeySet ().Contains (KEY_LAST_UPDATED_TIME_STRING)) {
mLastUpdateTime = savedInstanceState.GetString (KEY_LAST_UPDATED_TIME_STRING);
}
UpdateUI ();
}
}
示例3: UpdateValuesFromBundle
void UpdateValuesFromBundle (Bundle savedInstanceState)
{
Log.Info (TAG, "Updating values from bundle");
if (savedInstanceState != null) {
if (savedInstanceState.KeySet ().Contains (REQUESTING_LOCATION_UPDATES_KEY)) {
mRequestingLocationUpdates = savedInstanceState.GetBoolean (REQUESTING_LOCATION_UPDATES_KEY);
SetButtonsEnabledState();
}
if (savedInstanceState.KeySet ().Contains (LOCATION_KEY)) {
mCurrentLocation = (Location)savedInstanceState.GetParcelable (LOCATION_KEY);
}
if (savedInstanceState.KeySet ().Contains (LAST_UPDATED_TIME_STRING_KEY)) {
mLastUpdateTime = savedInstanceState.GetString (LAST_UPDATED_TIME_STRING_KEY);
}
UpdateUI ();
}
}
示例4: OnMessageReceived
public override async void OnMessageReceived(string from, Bundle data)
{
if (!ServiceFinder.IsRegistered<IPush>())
{
await FHClient.Init();
FH.RegisterPush(DefaultHandleEvent);
}
var push = ServiceFinder.Resolve<IPush>() as Push;
var message = data.GetString("alert");
var messageData = data.KeySet().ToDictionary(key => key, key => data.GetString(key));
(push.Registration as GcmRegistration).OnPushNotification(message, messageData);
}
示例5: printBundle
// 打印所有的 intent extra 数据
private static String printBundle(Bundle bundle) {
StringBuilder sb = new StringBuilder();
foreach (string key in bundle.KeySet()) {
if (key.Equals(JPushInterface.ExtraNotificationId)) {
sb.Append("\nkey:" + key + ", value:" + bundle.GetInt(key));
}else if(key.Equals(JPushInterface.ExtraConnectionChange)){
sb.Append("\nkey:" + key + ", value:" + bundle.GetBoolean(key));
}
else {
sb.Append("\nkey:" + key + ", value:" + bundle.GetString(key));
}
}
return sb.ToString();
}
示例6: OnMessageReceived
/// <summary>
/// Called when message is received.
/// </summary>
/// <param name="from"></param>
/// <param name="extras"></param>
public override void OnMessageReceived(string from,Bundle extras)
{
if (extras != null && !extras.IsEmpty)
{
System.Diagnostics.Debug.WriteLine(string.Format("{0} - GCM Listener - Push Received", PushNotificationKey.DomainName));
var parameters = new Dictionary<string, object>();
foreach (var key in extras.KeySet())
{
parameters.Add(key, extras.Get(key));
System.Diagnostics.Debug.WriteLine(string.Format("{0} - GCM Listener - Push Params {1} : {2}", PushNotificationKey.DomainName, key, extras.Get(key)));
}
Context context = Android.App.Application.Context;
if (CrossPushNotification.IsInitialized)
{
CrossPushNotification.PushNotificationListener.OnMessage(parameters, DeviceType.Android);
}
else
{
throw CrossPushNotification.NewPushNotificationNotInitializedException();
}
try
{
int notifyId = 0;
string title = context.ApplicationInfo.LoadLabel(context.PackageManager);
string message = "";
string tag = "";
if (!string.IsNullOrEmpty(CrossPushNotification.NotificationContentTextKey) && parameters.ContainsKey(CrossPushNotification.NotificationContentTextKey))
{
message = parameters[CrossPushNotification.NotificationContentTextKey].ToString();
}
else if (parameters.ContainsKey(PushNotificationKey.Message))
{
message = parameters[PushNotificationKey.Message].ToString();
}
else if (parameters.ContainsKey(PushNotificationKey.Subtitle))
{
message = parameters[PushNotificationKey.Subtitle].ToString();
}
else if (parameters.ContainsKey(PushNotificationKey.Text))
{
message = parameters[PushNotificationKey.Text].ToString();
}
if (!string.IsNullOrEmpty(CrossPushNotification.NotificationContentTitleKey) && parameters.ContainsKey(CrossPushNotification.NotificationContentTitleKey))
{
title = parameters[CrossPushNotification.NotificationContentTitleKey].ToString();
}
else if (parameters.ContainsKey(PushNotificationKey.Title))
{
if (!string.IsNullOrEmpty(message))
{
title = parameters[PushNotificationKey.Title].ToString();
}
else
{
message = parameters[PushNotificationKey.Title].ToString();
}
}
if (parameters.ContainsKey(PushNotificationKey.Id))
{
var str = parameters[PushNotificationKey.Id].ToString();
try
{
notifyId = Convert.ToInt32(str);
}
catch (System.Exception)
{
// Keep the default value of zero for the notify_id, but log the conversion problem.
System.Diagnostics.Debug.WriteLine("Failed to convert {0} to an integer", str);
}
}
if (parameters.ContainsKey(PushNotificationKey.Tag))
{
tag = parameters[PushNotificationKey.Tag].ToString();
}
if (!parameters.ContainsKey(PushNotificationKey.Silent) || !System.Boolean.Parse(parameters[PushNotificationKey.Silent].ToString()))
{
if (CrossPushNotification.PushNotificationListener.ShouldShowNotification())
{
CreateNotification(title, message, notifyId, tag);
}
}
//.........这里部分代码省略.........
示例7: OnMessageReceived
public override void OnMessageReceived (string from, Bundle data)
{
//Push Notification arrived - print out the keys/values
if (data != null) {
foreach (var key in data.KeySet ())
Android.Util.Log.Debug (MyRegistrationService.TAG,
"Key: {0}, Value: {1}", key, data.GetString (key));
}
/**
* Production applications would usually process the message here.
* Eg: - Syncing with server.
* - Store message in local database.
* - Update UI.
*/
/**
* In some cases it may be useful to show a notification indicating to the user
* that a message was received.
*/
}