コード例 #1
0
ファイル: MainActivity.cs プロジェクト: hydure/Rooster-Block
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            mmsReceiver = new MMSReceiver();
            smsReceiver = new SMSReceiver();
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());

            Log.Info("MainActivity", "Rob Completed Initialization");
        }
コード例 #2
0
        public override void OnReceive(Context context, Intent intent)
        {
            Log.Info(TAG, "Intent action received: " + intent.Action);

            // Retrieve message from the intent and analyze it.
            SmsMessage msg     = Android.Provider.Telephony.Sms.Intents.GetMessagesFromIntent(intent)[0];
            string     message = msg.DisplayMessageBody;

            (string, bool)result = MMSReceiver.CleanUpMessage(message);

            // If there were one or more rooster words.
            if (result.Item2)
            {
                string title = "Rooster Text Received From: " + msg.DisplayOriginatingAddress;
                DependencyService.Get <INotificationManager>().ScheduleNotification(title, result.Item1);
            }
        }