2017-08-08 96 views

回答

0

有兩種方式:
1. LocalBroadcastManager將發送消息只有您的應用程序

Intent message = new Intent("com.xamarin.example.TEST"); 
// If desired, pass some values to the broadcast receiver. 
intent.PutExtra("key", "value"); 
Android.Support.V4.Content.LocalBroadcastManager.GetInstance(this).SendBroadcast(message); 

2. Context.SendBroadcast方法將消息發送到整個系統

Intent message = new Intent("com.xamarin.example.TEST"); 
// If desired, pass some values to the broadcast receiver. 
intent.PutExtra("key", "value"); 
context.SendBroadcast(intent); 

from Xamarin guide

+1

非常感謝!它幫助了很多。 –

相關問題