2015-04-02 56 views
0
private void SaveToInbox(ShortMessages shortMessage) 
    { 
     var now = shortMessage.MessageDate.HasValue ? shortMessage.MessageDate.Value : DateTime.Now; 
     var d = new Date((now.Year - 1900), now.Month - 1, now.Day, now.Hour, now.Minute, now.Second); 
     var context = Application.Context.ApplicationContext; 
     var values = new ContentValues(); 
     values.Put("address", shortMessage.From); 
     values.Put("body", shortMessage.Message); 
     values.Put("read", false); 
     values.Put("date", d.Time); 
     context.ContentResolver.Insert(Android.Net.Uri.Parse("content://sms/inbox"), values); 
    } 

上面的代碼工作正常,在我的三星Galaxy S3迷你然而在我的三星Galaxy S5的消息不會被保存到手機的短信收件箱,誰能幫助我Xamarin保存短信銀河S5

回答

0

我現在知道,在較新的設備上,您必須將應用程序設置爲默認sms管理器才能使上述代碼工作