Windows Mobile 6 tapi and OpenNetCF telephone - compact-framework

I have a Ciperlab scanner running Windows Mobile 6 and compact framework 3.5. I have developed a phone interface from the app using OpenNetCF Telephony. This works well but at times the "hangup" takes up to 80 seconds before the "disconnected" event is driven". The OpenNetCF "hangup" method is a simple wrapper for the native tapi "lineDrop" method. Calling "lineDrop" without using the OpenNetCF wrapper gives the same problem. To try to break out of the 80 second delay I have a timer. In the timer_tick event I have tried to dispose of and re-initialise OpenNetCF but this then hangs the entire program and I have to reboot. Any suggestions on what is causing this 80 second delay and how to avoid it / break out of it would be welcomed

Related

Empty Firemonkey app crashes on startup just on Android 7.1, with error NullPointerException on String.contains(CharSequence)

I created a completely new and empty FMX app, tried it using Delphi 10.3.3 and 10.4.0 (patch 3), and when installed on Android 7.1.2 devices (tried two different ones and the official simulator VM), after the splash screen this error message appears:
'java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference'
The error message box flickers quickly (endless loop) and gets slower and slower and after a minute the complete device doesn't react anymore and I can only hard reset it.
I found this thread, so I'm not alone. They say it worked until Delphi 10.1.2. There are also many other similar search results.
Is there any solution? On other Android versions it works well.
Or what can I try to get more information about what causes it?
Do you know a good candidate for an app made with Firemonkey that I could download directly and try out on the device?
Now there is a fix available at quality.embarcadero.com!
Just one line has to be added to 'Androidapi.JNIBridge.pas'. I'm not sure if I should copy it here... Will update this answer when it is released.

WP8: Can this (PhoneApplicationService.RunningInBackground ) be used outside of location based app?

From this link below, it seems that your app can still get event when app is switched to background. But it seems it is used only for location based app. Can normal app do that? I had tried to declare ID_CAP_LOCATION but still Application_RunningInBackground not get called when switch to background.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.shell.phoneapplicationservice.runninginbackground(v=vs.105).aspx
The app doesn't execute in background, unless it is continously tracking the location.
This section lists the conditions under which the operating system
will deactivate an app running in the background....
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and
StatusChanged events of the Geolocator class or by calling the Stop()
method of the GeoCoordinateWatcher class.
Source: Running location-tracking apps in the background for Windows Phone 8
You will find complete info of how to run apps in background here:
How to run location-tracking apps in the background for Windows Phone 8

How to intercept didStartLoad in web view (metro apps)

I have been developing iOS and Mac OSX apps since years. So, I was pretty surprised to find no method for Windows 8 Metro WebView to intercept when it starts loading a new page, but only when it finishes loading.
Is there really any workaround for this? I could not find anything both in the docs and on the web...
Thank you very much!
Fabio
You can use the Window.External.Notify() method to trigger an event back in your C# or whatnot. You can also use the Webview.InvokeScript() to activate scripts from outside the control. You can write a script as a string outside the WebView and use the WebView.InvokeScript() with "eval" as the first arg to run that script inside the control.
ScriptNotify
This shows how to use both ScriptNotify and InvokeScript

Timer in Windows 8 app in background

I'm toying with Windows 8 SDK and I'd like to create an app that does something when a timer elapses. I've found out that when the app is suspended, the DispatcherTimer stops and resumes when the app comes back into the foreground. However, I'd like to schedule timer updates also in the background. What is the preferred solution to this problem (scheduling task for the future while the app is in background)?
You can use a Background task. Take a look to the example available at http://code.msdn.microsoft.com/windowsapps/Background-Task-Sample-9209ade9.
I found following article really helpful when working with BackgroundTask
31 Days of Windows 8 | Day #12: Background Tasks

Force WinRT app to snapped view

For one of my apps I'd like to send the app to snapped view after tapping a button. As far as I know there's no public API available to send a running application to snapped view. Did anyone find a workaround to do this?
Somehow it should be possible since you're able to do it in Windows 8 itself, and snap one of the running apps.
Update: Being able to trigger a Win+. might do the same trick, but the SendKeys API isn't available in WinRT either.
There is no way to force an application into snapped mode - it has to be a user initiated action.
An application can request to be unsnapped through:
Windows.UI.ViewManagement.ApplicationView.TryUnsnap();
Which tries to push the app into fill mode.
Windows 10 has a ApplicationView.TryResizeView method
So... to summarize the interesting WinRT journey:
Windows 8
Has a a 'Snapped' mode that a only a user can initiate. the developer can try to unsnap with the TryUnsnap method
Windows 8.1
Does not have Snapped mode, and TryUnsnap is deprecated. The dev can still listen for window size changes and know if the app view is in a smaller size as before.
Windows 10
Introduced the ApplicationView.TryResizeView method, where the dev can try to resize. Window size changed event is still there.
ApplicationView.GetForCurrentView().TryResizeView(new size(width, height)));