2015-01-05 113 views
1

我在項目中使用API​​級別10(Xamarin.Android v2.3支持)Xamarin Android本地通知

程序集引用丟失錯誤。

在主要活動

按鈕單擊處理程序是有下面的代碼

 Bundle valuesForActivity = new Bundle(); 
     valuesForActivity.PutInt("count", _count); 

     // Create the PendingIntent with the back stack 
     // When the user clicks the notification, SecondActivity will start up. 
     Intent resultIntent = new Intent(this, typeof(SecondActivity)); 
     resultIntent.PutExtras(valuesForActivity); // Pass some values to SecondActivity. 

     TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this); 
     stackBuilder.AddParentStack(Java.Lang.Class.FromType(typeof(SecondActivity))); 
     stackBuilder.AddNextIntent(resultIntent); 

     PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent); 

     // Build the notification   
     NotificationCompat.Builder builder = new NotificationCompat.Builder(this) 
      .SetAutoCancel(true) // dismiss the notification from the notification area when the user clicks on it 
      .SetContentIntent(resultPendingIntent) // start up this activity when the user clicks the intent. 
      .SetContentTitle("Button Clicked") // Set the title 
      .SetNumber(_count) // Display the count in the Content Info 
      .SetSmallIcon(Resource.Drawable.monoandroidsplash) // This is the icon to display 
      .SetContentText(String.Format("The button has been clicked {0} times.", _count)); // the message to display. 

     // Finally publish the notification 
     NotificationManager notificationManager = (NotificationManager)GetSystemService(NotificationService); 
     notificationManager.Notify(ButtonClickNotificationId, builder.Build()); 

     _count++;` 

得到錯誤的

TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this);

NotificationCompat.Builder builder = new NotificationCompat.Builder(this)

錯誤失蹤大會參考,並TaskStackBuilder不存在

我沒有得到什麼是裝配基準缺失 請幫助

回答

1

其後期的答覆,但可以幫助別人。

你提到的問題是,因爲Mono.Anroid

的版本(下)在低版本的發生(如4.2),則Android.App.TaskstackBuilder命名空間缺失。 升級Mono.Android可能會解決問題。