本文整理汇总了C#中ComponentName类的典型用法代码示例。如果您正苦于以下问题:C# ComponentName类的具体用法?C# ComponentName怎么用?C# ComponentName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentName类属于命名空间,在下文中一共展示了ComponentName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnCreate
/// <summary>
/// On create simply detect some of our managers
/// </summary>
public override void OnCreate()
{
base.OnCreate();
//Find our audio and notificaton managers
audioManager = (AudioManager)GetSystemService(AudioService);
wifiManager = (WifiManager)GetSystemService(WifiService);
remoteComponentName = new ComponentName(PackageName, new RemoteControlBroadcastReceiver().ComponentName);
}
开发者ID:helmsb,项目名称:AndroidStreamingAudio,代码行数:12,代码来源:StreamingBackgroundService.cs
示例2: OnServiceConnected
public void OnServiceConnected (ComponentName name, IBinder service)
{
Service = IAdditionServiceStub.AsInterface(service);
_activity.Service = (IAdditionService) Service;
_activity.IsBound = Service != null;
}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:7,代码来源:AdditionServiceConnection.cs
示例3: OnServiceDisconnected
public void OnServiceDisconnected(ComponentName name)
{
Log.Debug(TAG, $"OnServiceDisconnected {name.ClassName}");
IsConnected = false;
Binder = null;
mainActivity.timestampMessageTextView.SetText(Resource.String.service_not_connected);
}
开发者ID:xamarin,项目名称:monodroid-samples,代码行数:7,代码来源:TimestampServiceConnection.cs
示例4: OnServiceConnected
public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
{
Logger.Debug ("Billing service connected.");
Service = IInAppBillingServiceStub.AsInterface (service);
string packageName = _activity.PackageName;
try {
Logger.Debug ("Checking for in-app billing V3 support");
int response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.InApp);
if (response != BillingResult.OK) {
Connected = false;
}
Logger.Debug ("In-app billing version 3 supported for {0}", packageName);
// check for v3 subscriptions support
response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.Subscription);
if (response == BillingResult.OK) {
Logger.Debug ("Subscriptions AVAILABLE.");
Connected = true;
RaiseOnConnected (Connected);
return;
} else {
Logger.Debug ("Subscriptions NOT AVAILABLE. Response: {0}", response);
Connected = false;
}
} catch (Exception ex) {
Logger.Debug (ex.ToString ());
Connected = false;
}
}
开发者ID:camradal,项目名称:TodayILearned,代码行数:35,代码来源:InAppBillingServiceConnection.cs
示例5: OnServiceConnected
public void OnServiceConnected(ComponentName name, IBinder binder)
{
_binder = binder as AndroidSensusServiceBinder;
if (_binder != null && ServiceConnected != null)
ServiceConnected(this, new AndroidServiceConnectedEventArgs(_binder));
}
开发者ID:shamik94,项目名称:sensus,代码行数:7,代码来源:AndroidSensusServiceConnection.cs
示例6: InitMediaSession
internal void InitMediaSession(string packageName, MediaServiceBinder binder)
{
try
{
if (mediaSessionCompat == null)
{
Intent nIntent = new Intent(applicationContext, typeof(MediaPlayer));
PendingIntent pIntent = PendingIntent.GetActivity(applicationContext, 0, nIntent, 0);
RemoteComponentName = new ComponentName(packageName, new RemoteControlBroadcastReceiver().ComponentName);
mediaSessionCompat = new MediaSessionCompat(applicationContext, "XamarinStreamingAudio", RemoteComponentName, pIntent);
mediaControllerCompat = new MediaControllerCompat(applicationContext, mediaSessionCompat.SessionToken);
NotificationManager = new MediaNotificationManagerImplementation(applicationContext, CurrentSession.SessionToken, _serviceType);
}
mediaSessionCompat.Active = true;
mediaSessionCompat.SetCallback(binder.GetMediaPlayerService<MediaServiceBase>().AlternateRemoteCallback ?? new MediaSessionCallback(this));
mediaSessionCompat.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);
_packageName = packageName;
_binder = binder;
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
开发者ID:martijn00,项目名称:XamarinMediaManager,代码行数:25,代码来源:MediaSessionManager.cs
示例7: OnStart
public override void OnStart(Intent intent, int startId)
{
RemoteViews updateViews = buildUpdate (this);
ComponentName thisWidget = new ComponentName(this, "classicphone.ClassicPhoneWidget");
AppWidgetManager manager = AppWidgetManager.GetInstance (this);
manager.UpdateAppWidget (thisWidget, updateViews);
}
开发者ID:herkit,项目名称:ClassicPhone,代码行数:7,代码来源:UpdateService.cs
示例8: OnServiceConnected
public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
{
Service = IInAppBillingServiceStub.AsInterface (service);
string packageName = _activity.PackageName;
try {
int response = Service.IsBillingSupported (Xamarin.InAppBilling.Billing.APIVersion, packageName, "inapp");
if (response != BillingResult.OK) {
Connected = false;
}
// check for v3 subscriptions support
response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.Subscription);
if (response == BillingResult.OK) {
Connected = true;
RaiseOnConnected (Connected);
return;
} else {
Connected = false;
}
} catch (Exception ex) {
Connected = false;
}
}
开发者ID:shakor,项目名称:XamarinInAppBillingForCafeBazaar,代码行数:31,代码来源:InAppBillingServiceConnection.cs
示例9: OnReceive
public override void OnReceive (Context context, Intent intent)
{
var comp = new ComponentName (context,
Java.Lang.Class.FromType (typeof(GcmService)));
StartWakefulService (context, (intent.SetComponent (comp)));
ResultCode = Result.Ok;
}
开发者ID:jblj,项目名称:mobile,代码行数:8,代码来源:GcmBroadcastReceiver.cs
示例10: OnServiceConnected
public void OnServiceConnected(ComponentName name, IBinder service)
{
var mediaPlayerServiceBinder = service as MediaPlayerServiceBinder;
if (mediaPlayerServiceBinder != null)
{
instance.OnServiceConnected(mediaPlayerServiceBinder);
}
}
开发者ID:martijn00,项目名称:XamarinMediaManager,代码行数:8,代码来源:MediaPlayerServiceConnection.cs
示例11: OnServiceDisconnected
public void OnServiceDisconnected(ComponentName name)
{
IsPlayerBound = false;
if (_audioPlaybackBinder.IsBinderAlive)
_audioPlaybackBinder.Dispose();
_audioPlaybackBinder = null;
}
开发者ID:jayharry28,项目名称:Audiotica,代码行数:8,代码来源:App.cs
示例12: OnServiceConnected
public void OnServiceConnected(ComponentName name, IBinder service)
{
if (service is CompassServiceBinder)
{
_compassServiceBinder = (CompassServiceBinder)service;
OpenOptionsMenu();
}
}
开发者ID:42Spikes,项目名称:F2S,代码行数:8,代码来源:CompassMenuActivity.cs
示例13: OnServiceConnected
public void OnServiceConnected (ComponentName name, IBinder service)
{
var serviceBinder = service as StepServiceBinder;
if (serviceBinder != null) {
activity.Binder = serviceBinder;
activity.IsBound = true;
}
}
开发者ID:magicdukeman,项目名称:Giannios_John_Portfolio,代码行数:8,代码来源:StepServiceConnection.cs
示例14: OnServiceConnected
public void OnServiceConnected (ComponentName name, IBinder service)
{
var serviceBinder = service as ServiceBinder;
if (serviceBinder != null) {
Binder = serviceBinder;
Binder.IsBound = true;
ServiceConnected(this, new ServiceConnectedEventArgs { Binder = service } );
}
}
开发者ID:Fedorm,项目名称:core-master,代码行数:9,代码来源:ServiceConnection.cs
示例15: OnServiceConnected
/// <summary>
/// This is called when the connection with the service has been established.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="service">Service.</param>
public void OnServiceConnected(ComponentName name, IBinder service)
{
LocationServiceBinder serviceBinder = service as LocationServiceBinder;
if (serviceBinder != null) {
this.binder = serviceBinder;
ConnectionChanged(this, new ServiceConnectionEventArgs(true));
}
}
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:14,代码来源:LocationServiceConnection.cs
示例16: OnServiceConnected
public void OnServiceConnected (ComponentName name, IBinder service)
{
DataSyncBinderServiceProperty = service as DataSyncBinderService;
this.IsBackgroundSyncBound = true;
Task.Run (() => {
DataSyncBinderServiceProperty.Service.SyncData (App.WorkoutCreatorContext.StaffMember.GymID);
});
}
开发者ID:MobileFit,项目名称:CoachV2,代码行数:9,代码来源:DataSyncConnectionService.cs
示例17: OnServiceConnected
public void OnServiceConnected(ComponentName name, IBinder service)
{
playbackBinder = service as PlaybackBinder;
if (playbackBinder == null) {
throw new InvalidOperationException("Cannot bind to any service other than " + nameof(PlaybackService));
}
OnPlaybackServiceBound();
}
开发者ID:Machinarius,项目名称:AHFM,代码行数:9,代码来源:MainActivity.cs
示例18: OnStart
public override void OnStart (Intent intent, int startId)
{
// Build the widget update for today
RemoteViews updateViews = buildUpdate (this);
// Push update for this widget to the home screen
ComponentName thisWidget = new ComponentName (this, Java.Lang.Class.FromType (typeof (WordWidget)).Name);
AppWidgetManager manager = AppWidgetManager.GetInstance (this);
manager.UpdateAppWidget (thisWidget, updateViews);
}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:10,代码来源:UpdateService.cs
示例19: OnServiceDisconnected
public void OnServiceDisconnected(ComponentName name)
{
if (_binder != null)
{
if (ServiceDisconnected != null)
ServiceDisconnected(this, new AndroidServiceConnectedEventArgs(_binder));
_binder.SensusServiceHelper = null;
}
}
开发者ID:shamik94,项目名称:sensus,代码行数:10,代码来源:AndroidSensusServiceConnection.cs
示例20: OnServiceConnected
public void OnServiceConnected( ComponentName name, IBinder serviceBinder )
{
Rock.Mobile.Util.Debug.WriteLine( "OnServiceConnected - We are binding" );
AudioServiceBinder binder = serviceBinder as AudioServiceBinder;
if ( binder != null )
{
ConnectionFragment.ServiceConnected( binder );
}
}
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:10,代码来源:NotesListenFragment.cs
注:本文中的ComponentName类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论