Please assist as I have an issue with xamarin UITest , the EnterText method is not sending any keys to Android version 10 devices. the Repl() shows that the text is entered but on the actual device nothing is being inserted .The code works fine on Android version 9 and below enter image description here
There is a bug with xamarin ui test, see https://github.com/microsoft/appcenter/issues/1451
I implemented the following as a workaround:
protected bool OnAndroid => AppManager.Platform == Platform.Android;
protected bool OniOS => AppManager.Platform == Platform.iOS;
public void SetEntryText(Query entry, string entryName, string value)
{
if (OnAndroid)
{
app.Query(e => e.Marked(entryName).Invoke("setText", value));
}
else if (OniOS)
{
app.ClearText(entry);
app.EnterText(entry, value);
}
}
Related
Build environment:
Macbook M1
vscode(1.69.0) as well as vs2022 (17.3)
Steps to reproduce:
create new Maui app
add nuget package "Microsoft.Extensions.Http" Version="6.0.0" to project
Modify MauiProgram.cs:
builder.Services.AddHttpClient<EndPointAHttpClient>(client =>
{
var EndPointA = "https://www.montemagno.com/";
client.BaseAddress = new Uri(EndPointA);
});
public class EndPointAHttpClient
{
public EndPointAHttpClient(HttpClient client)
{
Client = client;
}
public HttpClient Client { get; }
}
Publish:
dotnet publish <project.csproj> -f:net6.0-ios -c:Release /p:ServerAddress=<xxx.xxx.xxx.xxx> /p:ServerUser=user /p:TcpPort=58181 /p:ServerPassword=pwd -p:AotAssemblies=false
Install on iphone using Transporter/TestFlight
CRASHES WHEN OPENING THE APP
Please let me know:
1. Is there any demo code that works
2. Kindly provide advise on how I can use HttpClient in a .net Maui app
Use the code found here. https://github.com/dotnet/maui-samples/tree/main/6.0/WebServices/TodoREST/TodoREST/Services
Grab the RestService, IRestService, HttpsClientHandlerService and IHttpsClientHandlerService.
Get the Contstants file as well.
https://github.com/dotnet/maui-samples/blob/main/6.0/WebServices/TodoREST/TodoREST/Constants.cs
Makes sure you add your Url to the HttpsClientHandlerService like so. I was getting a System.Net.WebException: Error: TrustFailure. The only way I was able to catch what was happening was using Sentry.io. I guessed that this might be the problem.
public bool IsSafeUrl(NSUrlSessionHandler sender, string url, Security.SecTrust trust)
{
if (url.StartsWith("https://localhost") || url.StartsWith("https://yourservice.azurewebsites.net"))
return true;
return false;
}
Then change this line.
var handler = new NSUrlSessionHandler
{
TrustOverrideForUrl = IsSafeUrl
};
I have created ionic app and used cordova-plugin-speechrecognition for speech to text conversion.
This works well in android mobile and ios emulator but doesn't work on IOS 13.3
initSpeech() {
this.speechRecognition.hasPermission()
.then((hasPermission: boolean) => {
console.log(hasPermission)
if (!hasPermission) {
this.speechRecognition.requestPermission()
.then(
() => console.log('granted'),
() => console.log('Denied')
)
}
})
}
start() {
// Start the recognition process
this.speechRecognition.startListening()
.subscribe(
(matches: Array<string>) => { this.voicetext = matches[0]; this.mainForm.controls['comments'].setValue(matches[0]); },
(onerror) => console.log('error:', onerror)
)
}
//stop listening for(ios only)
stop() {
this.speechRecognition.stopListening();
}
code specified in the link https://ionicframework.com/docs/native/speech-recognition is what I have used.
For IOS I have also implemented stop listening and added NSMicrophoneUsageDescription permission
NSSpeechRecognitionUsageDescription permission in info.list of ios .
Please help me with this. Thanks in advance
It actually works but with delay, so couldn't recognize its being triggered.
Now I'm developing IOS App and I want to check if the Viber App is existing in the Phone or not.
I already use Viber:\\ URL scheme and https://ionicframework.com/docs/native/app-availability/ to check the app but the app is not detecting
There's any possible implementation?
Thanks
Try this;
import { AppAvailability } from '#ionic-native/app-availability';
import { Platform } from 'ionic-angular';
constructor(private appAvailability: AppAvailability, private platform: Platform) { }
let app;
if (this.platform.is('ios')) {
app = 'Viber://';
} else if (this.platform.is('android')) {
app = 'com.viber.voip ';
}
this.appAvailability.check(app)
.then(
(yes: boolean) => console.log(app + ' is available'),
(no: boolean) => console.log(app + ' is NOT available')
);
the URLScheme must be declared publicly in Info.plist file first
visit this UseYourLoaf tutorial for more details
i fixed it by check if these is exist
viber = "https://itunes.apple.com/ph/app/viber-messenger-chats-calls/id382617920?mt=8"
and
use app-availability
this.appAvailability.check(viber)
I am working on Xamarin.Forms app and it's working perfectly fine on Android device. Anyway, when I am trying to run it on iPhone simulator it's just showing the main screen of the app, but none of the features are working.
The main screen consists of two parts of which one is to browse and open files and the other is to open a menu. The layout consists of Browse, process and exit buttons and when I click on the browse button to open file explorer an alert is displayed, that something went wrong.
I enabled breakpoints and tried debugging it, but the control is going to catch exception part directly.
Here is the code for it can anyone please help me with this part? I am using Xamarin.Plugin.Filepicker NuGet package. When I place the cursor on the Exception I can see that
System.NotImplemented Exception:This functionality is not implemented in the portable version of this assembly,you should reference the NuGet Package from your main application project in order to reference the platform specific
and the code is
private Plugin.FilePicker.Abstractions.FileData file =
default(Plugin.FilePicker.Abstractions.FileData);
public async void OnBrowse(object o, EventArgs args)
{
try
{
// var file_path =
this.file = await CrossFilePicker.Current.PickFile();
if (this.file == null)
{
return;
}
string extensionType = this.file.FileName.Substring(
this.file.FileName.LastIndexOf(".",
StringComparison.Ordinal) + 1,
this.file.FileName.Length -
this.file.FileName.LastIndexOf(".", StringComparison.Ordinal) -
1).ToLower();
fileName = this.file.FileName;
if (extensionType.Equals("csv"))
{
csv_file.Text = (fileName);
}
else
{
await this.DisplayAlert("Name of the file:" + file.FileName, "File info", "OK");
}
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Initialize("/storage/emulated/0");
}
}
catch (Exception e)
{
await DisplayAlert("Alert", "Something went wrong", "OK");
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Log(e.Message);
}
}
}
I started working on a project that was built using OneSignal v1.15.2.
On Android everything works fine.
On iOS instead, I tried to follow this: https://documentation.onesignal.com/v3.0/docs/unity-sdk-setup (points [5.1 - 5.7]: they just add UserNotifications.framework)
Now, if I launch my application it crashes and the message is: "dyld: image not found".
If I remove UserNotifications.framework the all game runs ok but notifications.
Is the current version of OneSignal so different from the past? Is there another setup process guide that I should follow?
I'm using Unity 5.3.1p4 and XCode 8.2.1 (I was using XCode 8.3.1 and notifications worked well, but this newer version have some documented incompatibility with Unity 5.3.1p4).
Can anyone help me?
Thank you.
Best regard,
Andrea.
For what it's worth I'm using Unity 5.6.0 and Xcode 8.3.2 with the SDK Unity5OneSignalSDK.unitypackage and points 5.1 through 5.7 where sufficient to get push notifications working.
I am also automating the background modes to check "remote-notifications" using the following post processor ... I can't find a way to automate the link with UserNotifications.framework yet tho ... let me know if anybody has ideas on how to do that.
// ---------------------------------------------------------------------------------------------------------------------
public static class XCodePostProcess
{
// -----------------------------------------------------------------------------------------------------------------
[PostProcessBuild(100)]
public static void OnPostprocessBuild( BuildTarget target, string pathToBuildProject )
{
if (target == BuildTarget.iOS)
{
UpdateInfoPlist( pathToBuildProject );
}
}
// -----------------------------------------------------------------------------------------------------------------
private static void UpdateInfoPlist( string path )
{
// load plist
string plistPath = Path.Combine( path, "Info.plist" );
PlistDocument plist = new PlistDocument();
plist.ReadFromString( File.ReadAllText( plistPath ) );
//Get Root
PlistElementDict rootDict = plist.root;
//Add Necessary Things
PlistElementArray LSApplicationQueriesSchemes = rootDict.CreateArray( "LSApplicationQueriesSchemes" );
LSApplicationQueriesSchemes.AddString( "itms-beta" ); // test flight
// localizations
PlistElementArray CFBundleLocalizations = rootDict.CreateArray( "CFBundleLocalizations" );
CFBundleLocalizations.AddString( "en" ); // english
CFBundleLocalizations.AddString( "de" ); // german
CFBundleLocalizations.AddString( "fr" ); // french
CFBundleLocalizations.AddString( "es" ); // spanish
// for OneSigna remote notifications
PlistElementArray UIBackgroundModes = rootDict.CreateArray( "UIBackgroundModes" );
UIBackgroundModes.AddString( "remote-notification" );
//WriteFile
File.WriteAllText (plistPath, plist.WriteToString ());
}
}