PhoneGap Build - navigator.notification.alert not working in WP7 emulator - phonegap-build

I build this simple code with PGB, but it does not working in WP7 emulator - no alert message.
For android emulator its ok.
What's wrong?
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
navigator.notification.alert("Device Ready!");
}
Source code https://github.com/dprotopopov/pgb-wp7-alert

This seems to be a bug with the latest PhoneGap build for WP7. I have this up and running in Visual Studio and although the navigator object is accessible in the code there is no notification property available. You can test the same yourself by iterating through the properties of the navigator object in your app;
for(var key in navigator){
document.write(key + "<br>");
}
The list I get is as follows, note that notification is not one of them :(
appCodeName
appMinorVersion
browserLanguage
cookieEnabled
cpuClass
mimeTypes
plugins
systemLanguage
userLanguage
msDoNotTrack
geolocation
appName
appVersion
platform
userAgent
onLine
javaEnabled
taintEnabled

Related

loadCustomPropertiesAsync method times out on Outlook for Android

I have an Outlook add-in that attempts to fetch a custom property that is stored with the mail item using the loadCustomPropertiesAsync [1]:
Office.context.mailbox.item.loadCustomPropertiesAsync(function(asyncResult){
var customProps = asyncResult.value;
console.log(customProps.get("some.prop"));
})
The above snippet of code seems to time out when I access the add-in from Outlook for Android (v3.0.40) app, but works fine on iOS, Firefox and Chrome (Tested on both Windows 10 and Mac ).
Is this a bug?
[1] https://learn.microsoft.com/en-us/office/dev/add-ins/reference/objectmodel/requirement-set-1.3/office.context.mailbox.item

Command not triggered in release build

I've got a button on my MainPage that navigates to the next view. This works great in debug build on the simulated android device (Android 8.1 accelerated x86) on my windows PC (Visual Studio 2017).
The button is bound to my viewmodel from my view like that:
<Button Text="Report error" Command="{Binding NewErrorCommand}" />
The viewmodel code:
public Command NewErrorCommand
{
get
{
return _newErrorCommand ?? (_newErrorCommand = new Command(ExecuteNewErrorCommand, CanNewErrorCommand));
}
}
private bool CanNewErrorCommand(object arg)
{
return true;
}
private async void ExecuteNewErrorCommand(object obj)
{
try
{
// I'll get here in simulation/debug build but not in release build on device
await Application.Current.MainPage.DisplayAlert("Go", "Go", "Ok");
await _navigation.PushAsync(new TestView(), false);
}
catch (Exception exc)
{
await Application.Current.MainPage.DisplayAlert("Error", exc.Message, "Cancel");
}
}
My whole App is running just fine with the simulator. If I hit the button on my real physical device, I see the visual feedback (button changes color) but nothing happens at all.
What I tried so far:
apllied some printf debugging with DisplayAlert (not hit, see source code)
connected a bluetooth mouse to my android device (android 6.0) in case there are differences between mouse click and finger tap (still no working button)
Can you help a Xamarin.Forms beginner?
Update
I connected my android phone via USB to debug. The button works in debug mode (is hitting breakpoints, opening new page) but still not functional in release build.
Linker settings as per request:
The release version will work if you set the linking options to "SDK assemblies only", in the Build section of the Android project properties.
When the linker is enabled and set to "SDK and User assemblies", a lot of code (which is pressumed not to be used) is removed. In your case, the NewErrorCommand property is being stripped out because the tool assumes you are not using it.
It works if you set it to "SDK assemblies only" because under that configuration the linker won't touch any of your own assemblies.

cordova-plugin-inappbrowser won't open system browser in IOS when using Phonegap Build

I'm trying to get links in a Phonegap app to open the system browser but recently they stopped working when using Phonegap build. They work if I build the app locally and put it on my phone, but now when the app is built using Phonegap build. I'm including it in my config file like this:
I also have the following code in my deviceready listener:
$$(document).on('deviceready', function() {
console.log("Device is ready!");
window.open = cordova.InAppBrowser.open;
});
And finally, here's an example of what my links look like:
Dashboard
I've whitelisted the urls that I would like to open. The strange thing is that if I leave my app, the browser opens and goes to the url. It appears that I must exit the app to get the link to trigger. Has anyone run into this problem?

Ti.App.iOS `continueactivity` not working on production build

I have a Titanium app that's handling an incoming Universal Link by capturing the iOS continueactivity event. This is the code I have:
if(OS_IOS){
Ti.App.iOS.addEventListener('continueactivity', function(e){
if(e.activityType === "NSUserActivityTypeBrowsingWeb"){
handleURL(e.webpageURL);
}
});
}
This code works perfectly while the app is being debugged but it seems like the event is not fired on the production build.
any ideas?
UPDATE: I just confirmed that this is also happening on the Ti Example App with SDK 5.3.0.
This is a known issue and was reported here:
https://jira.appcelerator.org/browse/TIMOB-20220
It has been fixed for version 5.4.0.

Xamarin Integrating Platform Specific Components into Cross Platform Code

I have a simple cross platform app written in Xamarin with VS. All the UI is built in a shared (portable) class so it's written once (using Xamarin Forms) and covers both Android and iOS.
I now just want to add simple loading HUD and I cannot see any good cross platform HUDs. They're all just either written for iOS or Android. I just want to know how I can add a component to the Android and iOS project and access that from the shared class. i.e. Have a method in my shared class called ShowLoading() which loads the iOS component on iOS and android in Android (funny that).
Any ideas?
Thanks
Here is a github project for cross-platform progress hud (it uses ANDHud and BTProgressHud under the covers). https://github.com/aritchie/acr-xamarin-forms
According to the examples, you could do something as simple as:
private readonly IUserDialogService dialogService;
public ICommand Alert {
get {
return new Command(async () => {
await dialogService.AlertAsync("Test alert", "Alert Title", "CHANGE ME!");
this.Result = "Returned from alert!";
});
}
}
You can use a Dependancy Service to access platform specific code from your common code.
I would also recommend having a look at the BT Progress HUD component (for iOS), and the And HUD component (for android) for your loading hud. They can be used together in a cross platform manner, via the XHUD API.

Resources