本文整理汇总了C#中Android.Content.Intent.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.ToString方法的具体用法?C# Intent.ToString怎么用?C# Intent.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnHandleIntent
protected override void OnHandleIntent (Intent intent)
{
Log.Debug (TAG, "onHandleIntent(intent=" + intent.ToString () + ")");
ResultReceiver receiver = (ResultReceiver)intent.GetParcelableExtra (EXTRA_STATUS_RECEIVER);
if (receiver != null)
receiver.Send (StatusRunning, Bundle.Empty);
Context context = this;
var prefs = GetSharedPreferences (Prefs.IOSCHED_SYNC, FileCreationMode.Private);
int localVersion = prefs.GetInt (Prefs.LOCAL_VERSION, VERSION_NONE);
try {
// Bulk of sync work, performed by executing several fetches from
// local and online sources.
long startLocal = Java.Lang.JavaSystem.CurrentTimeMillis ();
bool localParse = localVersion < VERSION_CURRENT;
Log.Debug (TAG, "found localVersion=" + localVersion + " and VERSION_CURRENT=" + VERSION_CURRENT);
if (localParse) {
// Load static local data
mLocalExecutor.Execute (Resource.Xml.blocks, new LocalBlocksHandler ());
mLocalExecutor.Execute (Resource.Xml.rooms, new LocalRoomsHandler ());
mLocalExecutor.Execute (Resource.Xml.tracks, new LocalTracksHandler ());
mLocalExecutor.Execute (Resource.Xml.search_suggest, new LocalSearchSuggestHandler ());
mLocalExecutor.Execute (Resource.Xml.sessions, new LocalSessionsHandler ());
// Parse values from local cache first, since spreadsheet copy
// or network might be down.
// mLocalExecutor.execute(context, "cache-sessions.xml", new RemoteSessionsHandler());
// mLocalExecutor.execute(context, "cache-speakers.xml", new RemoteSpeakersHandler());
// mLocalExecutor.execute(context, "cache-vendors.xml", new RemoteVendorsHandler());
// Save local parsed version
prefs.Edit ().PutInt (Prefs.LOCAL_VERSION, VERSION_CURRENT).Commit ();
}
Log.Debug (TAG, "local sync took " + (Java.Lang.JavaSystem.CurrentTimeMillis () - startLocal) + "ms");
// Always hit remote spreadsheet for any updates
long startRemote = Java.Lang.JavaSystem.CurrentTimeMillis ();
// mRemoteExecutor.executeGet(WORKSHEETS_URL, new RemoteWorksheetsHandler(mRemoteExecutor));
Log.Debug (TAG, "remote sync took " + (Java.Lang.JavaSystem.CurrentTimeMillis () - startRemote) + "ms");
} catch (Exception e) {
Log.Error (TAG, "Problem while syncing", e);
if (receiver != null) {
// Pass back error to surface listener
Bundle bundle = new Bundle ();
bundle.PutString (Intent.ExtraText, e.ToString ());
receiver.Send (StatusError, bundle);
}
}
// Announce success to any surface listener
Log.Debug (TAG, "sync finished");
if (receiver != null)
receiver.Send (StatusFinished, Bundle.Empty);
}
示例2: OnReceive
public override void OnReceive(Context context, Intent intent)
{
Log.D(Tag + ".OnReceive", "Received intent: {0}", intent.ToString());
if (_ignoreNotifications) {
Log.D(Tag + ".OnReceive", "Ignoring received intent: {0}", intent.ToString());
_ignoreNotifications = false;
return;
}
Log.D(Tag + ".OnReceive", "Received intent: {0}", intent.ToString());
var manager = (ConnectivityManager)context.GetSystemService(Context.ConnectivityService);
var networkInfo = manager.ActiveNetworkInfo;
var status = networkInfo == null || !networkInfo.IsConnected
? NetworkReachabilityStatus.Unreachable
: NetworkReachabilityStatus.Reachable;
if (!status.Equals(_lastStatus))
{
_callback(status);
}
lock(lockObject)
{
_lastStatus = status;
}
}