I would like to show a notification when Received SMS... but can't do it because I can't change to static 'StartService(intente);' what should I change in my code?
public override void OnReceive(Context context, Intent intent)
{
if (intent.HasExtra("pdus"))
{
var smsArray = (Java.Lang.Object[])intent.Extras.Get("pdus");
string address = "";
string message = "";
foreach (var item in smsArray)
{
var sms = SmsMessage.CreateFromPdu((byte[])item);
_message = sms.MessageBody;
_sender = sms.OriginatingAddress;
}
if (_sender.Contains(txtCarNumber.Text.Substring(1, 10)))
{
MsgReceived(_message, context);
SwitchClass.StopProgress();
// For Show on Notification
var intente = new Intent(context, typeof(NotificationsCommand));
intente.PutExtra("Command", "TurnOff");
StartService(intente); //=> here compiler say should be Static
// End
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.