是否有任何关于失败时NotificationOutcome类状态的文档?
NotificationOutcome result = await _hub.SendNotificationAsync(azureNotification, tags);
Run Code Online (Sandbox Code Playgroud)
在MSDN文档是相当(完全)没用.
我猜测非零result.Failure并result.Success意味着出现问题(成功时似乎都是0)result.State可能更有用但是似乎没有太多关于此的文档
每次运行我的cordova应用程序时,我都试图添加firebase调试启动参数。
启动参数是:
-FIRDebugEnabled
谷歌搜索,我看到人们手动编辑 xcodeproj 文件并以这种方式添加参数。我这样做了,当我通过 Xcode 运行我的应用程序时效果很好,但是当我尝试运行时cordova run ios,没有使用启动参数。如果有一个解决方案不需要每个下载源代码的开发人员都去手动编辑 xcodeproj,那就太好了。
有没有其他方法可以在 Cordova 中指定启动参数?还是我做错了什么?
我知道有一个buildFlag可以通过命令行或 build.json 传入的,但我认为这不是这个特定启动参数的正确位置?
我Map正在 Xamarin.Forms 中创建一个,如下所示:
var map = new Map(MapSpan.FromCenterAndRadius(eventLoc, Distance.FromMiles(1)))
{
IsShowingUser = true,
MapType = MapType.Hybrid
};
Run Code Online (Sandbox Code Playgroud)
这eventLoc是Position我希望我的地图最初应该关注的地方。尽管它是这样开始的,但当定位服务找到我的位置时,地图焦点会转到我的位置,因为我设置了IsShowingUser = true。然而,这不是我想要的。我写这篇文章是IsShowingUser = true因为我也想在地图上显示我的位置,但不关注那里。
如何才能保持在eventLoc我提供给地图的初始位置 ( ) 上,同时显示我的位置?
我正在使用 Xamarin.Forms 进行编程。我想知道如何OnPlatform在 XAML 中使用仅设置单个平台的高度请求?-1如果未引用平台,我想保留默认值。
我目前有以下代码:
<ListView.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="WPF" Value="153" />
<On Platform="Android" Value="-1" />
<On Platform="iOS" Value="-1" />
<On Platform="UWP" Value="-1" />
</OnPlatform>
</ListView.HeightRequest>
Run Code Online (Sandbox Code Playgroud)
我希望我只需要写这样的东西:
<ListView.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="WPF" Value="153" />
</OnPlatform>
</ListView.HeightRequest>
Run Code Online (Sandbox Code Playgroud)
这不行,可以吗?
我需要一些帮助来使用 Azure 通知中心为多个模板注册 iOS 设备。
注册单个模板工作正常,但似乎从单个设备注册多个模板时,注册的第二个模板始终正常工作,而注册的第一个模板无法正常工作。
前几天我发现一些东西说每个模板都必须有一个独特的 PNS 句柄,但即使获得(我认为可能是)2 个独特的 PNS 句柄似乎也不起作用。
模板#1:
{"aps":{"title":"$(emergencyTitle)","alert":"$(emergencyMessage)","tags":"$(emergencyTags)"}}
Run Code Online (Sandbox Code Playgroud)
模板#2:
{"aps":{"content-available":1,"title":"$(regularTitle)","alert":"$(regularMessage)","inAppMessage":"$(regularMessage)","tags":"$(regularTags)"}}
Run Code Online (Sandbox Code Playgroud)
下面的代码被调用两次(我希望能得到 2 个唯一的 PNS 句柄)。每次,它都会将 保存deviceToken在一个变量中,以便我可以向它们注册 2 个模板:
if(UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) {
UIApplication.SharedApplication.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new Foundation.NSSet()));
UIApplication.SharedApplication.RegisterForRemoteNotifications();
} else {
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound);
}
Run Code Online (Sandbox Code Playgroud)
然后,以下精简代码调用通知中心以尝试注册 2 个模板:
Hub = Hub ?? new WindowsAzure.Messaging.SBNotificationHub(Constants.ConnectionString, Constants.NotificationHubPath);
// App.PushNotificationPnsHandles is a Dictionary<string, object> that holds an 'emergency' or 'regular' key and the deviceTokens
// Constants.EmergencyNotificationTemplate and Constants.RegularNotificationTemplate hold the template strings …Run Code Online (Sandbox Code Playgroud) 我在iOS中的声明中遇到以下问题。当用户在后台返回到应用程序时,我需要激活一个命令。在我身上,ContentPage我找不到识别退货的方法。在Android中,它可以正常工作,仅在iOS中,我无法在内容中找到任何表明我要返回的函数
protected override void OnAppearing()
{
Debug.WriteLine("OnAppearing()");
base.OnAppearing();
}
protected override void OnDisappearing()
{
Debug.WriteLine("OnDisappearing");
base.OnDisappearing();
}
protected override void OnBindingContextChanged()
{
Debug.WriteLine("OnBindingContextChanged");
base.OnBindingContextChanged();
}
Run Code Online (Sandbox Code Playgroud)
我尝试了三种选择,但没有结果
我对此很陌生,如果这是一个愚蠢的问题,那就很抱歉.如何让我的Xamarin.Forms应用程序在状态栏下方或缺口处开始?我尝试过使用过NavigationPage,但是它开始磨损屏幕顶部.我还看到了其他一些解决方案,但我无法使其发挥作用.有人可以帮忙吗?
谢谢!
我正在使用库https://github.com/aritchie/notifications,并且可以正确创建和安排通知。
我希望在Android中对其进行处理,以便根据通知-当用户点击该页面时,它将导航到特定页面。
我发现当我点击通知时(在我的Android项目中)会触发以下事件
protected override void OnNewIntent(Intent intent)
{
}
Run Code Online (Sandbox Code Playgroud)
但是,我无法从通知中找到任何意图来建立到特定页面的导航的信息。
任何意见,将不胜感激。
干杯!
编辑#1(为相关问题添加其他代码):
如果我发出通知,并在收到通知之前关闭该应用程序-我收到一条错误消息,指出该应用程序已崩溃。如果我收到通知并关闭应用程序-我可以从通知OK中加载应用程序。
我有一个依赖项服务,它可以使用以下方法。
public void Remind(DateTime dateTime, string msgtype, string usermedid)
{
DateTime now = DateTime.Now;
var diffinseconds = (dateTime - now).TotalSeconds;
Intent alarmIntent = new Intent(Forms.Context, typeof(AlarmBroadcastReceiver));
alarmIntent.PutExtra("notificationtype", msgtype);
alarmIntent.PutExtra("id", id);
PendingIntent pendingIntent = PendingIntent.GetBroadcast(Forms.Context, 0, alarmIntent, PendingIntentFlags.UpdateCurrent);
AlarmManager alarmManager = (AlarmManager)Forms.Context.GetSystemService(Context.AlarmService);
//TODO: For demo set after 5 seconds.
alarmManager.Set(AlarmType.ElapsedRealtime, SystemClock.ElapsedRealtime() + diffinseconds * 1000, pendingIntent);
}
[BroadcastReceiver(Enabled = true)]
[IntentFilter(new string[]{"android.intent.action.BOOT_COMPLETED"}, Priority = …Run Code Online (Sandbox Code Playgroud) 我读的地方,当你添加using System;到您的.cs文件,编译器(或者别的东西)将所有System相关的类到你的cs文件,因此也许是最好不要随时添加using System;,而是引用您DateTime拥有完整的命名空间是这样的:System.DateTime,例如,如果它很容易做,很少有东西System在你的.cs文件中引用它.
这是真的,如果是这样,是否会损害性能或增加应用程序的大小?如果是这样,我意识到这using System;更容易编写并且是方便的,因此,您必须权衡方便性和性能.也可能是这样的情况,即只添加一个using System;可能没有太大区别但是当添加了许多引用时,也许它可以?谢谢!
我在网上看到各种示例,说出如何接受它们,但我总是收到SSL错误,并且无法建立与服务器的安全连接。
我会注意到,该方法肯定是被调用的(在iOS 8.4模拟器和iOS 11实际设备上运行),因此未调用该方法不是这里的问题。
到目前为止,我已经尝试过(显然,我仅在开发中而不是在生产中使用此代码,等等等等):
1:
public override void DidReceiveAuthenticationChallenge(WKWebView webView, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler) {
completionHandler(NSUrlSessionAuthChallengeDisposition.UseCredential, new NSUrlCredential(serverTrust));
}
Run Code Online (Sandbox Code Playgroud)
2:
public override void DidReceiveAuthenticationChallenge(WKWebView webView, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler) {
completionHandler(NSUrlSessionAuthChallengeDisposition.UseCredential, NSUrlCredential.FromTrust(serverTrust));
}
Run Code Online (Sandbox Code Playgroud)
3:
public override void DidReceiveAuthenticationChallenge(WKWebView webView, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler) {
SecTrust serverTrust = challenge.ProtectionSpace.ServerSecTrust;
NSData exceptions = serverTrust.GetExceptions();
serverTrust.SetExceptions(exceptions);
exceptions.Dispose();
completionHandler(NSUrlSessionAuthChallengeDisposition.UseCredential, NSUrlCredential.FromTrust(serverTrust));
}
Run Code Online (Sandbox Code Playgroud)
4:
public override void DidReceiveAuthenticationChallenge(WKWebView webView, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler) {
SecTrust serverTrust = challenge.ProtectionSpace.ServerSecTrust; //TODO: Get …Run Code Online (Sandbox Code Playgroud) 我试图在点击或单击所选框后显示警告ListView框.目前selectedItem是绑定到SelectedTicket,它触发SelectedTicketViewModel中的对象调用.一旦SelectedTicket被触发,它随后执行popup.show()该方法DisplayAlert()的方法.该DisplayAlert()方法得到执行,但不显示AlertBox.
==============================================
//// Xaml Page
<ListView ItemsSource="{Binding TicketList,Mode=OneWay}" RowHeight="130"
ItemTemplate="{StaticResource TicketListTileTemplate}" BackgroundColor="#d9deeb"
SelectedItem="{Binding SelectedTicket, Mode=TwoWay}" SeparatorVisibility="None">
</ListView>
Run Code Online (Sandbox Code Playgroud)
==================================================
//// ViewModal
public object SelectedTicket
{
get
{
return _SelectedTicket;
}
set
{
if (SetProperty(ref _SelectedTicket, value))
{
if ((value != null) && (value is TicketListItem))
{
popup1.Show();
SelectedTicket = null;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
================================================== ====
////Popup.cs
async public void Show()
{
DisplayAlert("Alert", "Your have …Run Code Online (Sandbox Code Playgroud) 我只是想知道在 Xamarin.Forms 中使用 PCL 有什么好处。我的意思是你无论如何都要在每个平台之间共享代码。在 Xamarins 本机方法中,它非常清楚。所以也许有人可以告诉我为什么在 Xamarin.Forms 中使用 PCL?