public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { if (_card == null) { _card = new LiveCard(Application, "remoteviewservice"); _remoteViews = new Android.Widget.RemoteViews(PackageName, Resource.Layout.MainLayout); _remoteViews.SetTextViewText(Resource.Id.LivecardContent, "HI From Remote View!"); _card.SetViews(_remoteViews); var menuIntent = new Intent(this, typeof(MenuActivity)); menuIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); _card.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0)); _card.Publish(LiveCard.PublishMode.Reveal); } return StartCommandResult.Sticky; }
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { if (livecard == null) { livecard = new LiveCard(Application, "beacon"); remoteViews = new RemoteViews(PackageName, Resource.Layout.LiveCardBeacon); remoteViews.SetTextViewText(Resource.Id.LivecardContent, "Finding the monkey..."); livecard.SetViews(remoteViews); // Set up the live card's action with a pending intent // to show a menu when tapped var menuIntent = new Intent(this, typeof(MenuActivity)); menuIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); livecard.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0)); livecard.Publish(LiveCard.PublishMode.Reveal); } return(StartCommandResult.Sticky); }
private void UpdateDisplay(string message, Android.Graphics.Color color) { //Uncomment if you want to hear a success sound on every screenupdate // AudioManager audio = (AudioManager) GetSystemService(Context.AudioService); // audio.PlaySoundEffect((SoundEffect)Sounds.Success); if (color == Android.Graphics.Color.Yellow) { remoteViews.SetTextColor(Resource.Id.LivecardContent, Android.Graphics.Color.Black); } else { remoteViews.SetTextColor(Resource.Id.LivecardContent, Android.Graphics.Color.White); } remoteViews.SetInt(Resource.Id.Framelayout1, "setBackgroundColor", color); remoteViews.SetTextViewText(Resource.Id.LivecardContent, message); livecard.SetViews(remoteViews); }
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { if (livecard == null) { livecard = new LiveCard (Application, "beacon"); remoteViews = new RemoteViews (PackageName, Resource.Layout.LiveCardBeacon); remoteViews.SetTextViewText (Resource.Id.LivecardContent, "Finding the monkey..."); livecard.SetViews (remoteViews); // Set up the live card's action with a pending intent // to show a menu when tapped var menuIntent = new Intent(this, typeof(MenuActivity)); menuIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); livecard.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0)); livecard.Publish (LiveCard.PublishMode.Reveal); } return StartCommandResult.Sticky; }