Call directly without extra dialog in iOS using Ionic 4 - ios

I'm trying to call a number from my app, but I want to do that without having to click on the modal that appears with "Cancel" and "Call" after I clicked my button in the app. Just click the button in the app and go straight to the call. Can I do that?
I already installed the native plugin [call-number] and the ionic package. It's working, it's making the call, It's just that I would like to make the call without that extra step.

Not sure if thats possible. Plugins provide communication between the ionic layer and the native layer so you are usually limited by the options the plugin gives you.
According to the documentation all you can do is bypass the choice of the calling app.
https://github.com/Rohfosho/CordovaCallNumberPlugin

You can't bypass that dialog. It is provided by iOS as an extra layer of protection for the user. It stops malicious apps initiating calls that may incur costs without user acknowledgement.

Related

iOS - Trigger click events outside of the app - like in app drawer

How can you trigger touch and type events outside of your app. I already have created a service that can collect certain data but I can't trigger clicks.
P. S. My requirement is to have a device cloud hosted on the internet and allow people to access them remotely
This is not possible. Apple would never allow such a huge security risk.
You misunderstand how Seetest works. Seetest requires access to your App's binary code, which it instruments:
https://docs.experitest.com/display/public/UFT/iOS+Applications
It then simulates user events by calling event handling methods, e.g. #IBAction handlers. It does not go to the low level that you want, because nothing can unless you violate Apple's usage rules.
EDIT
I was assuming you wanted to write an iOS App that could generate events outside of its sandbox. Instead I think you're referring to Instruments which is controlled by a host.
Because this is a general question, see if this gets you in the right direction:
https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html
I have managed to do this using Appium java API. First launch a dummy app, then call driver.back() and from there, you will have full control

React-native detect click on WebView

Is there solution to detect click anywhere on reacts-native WebView? Tried to put it inside TouchableOpacity but I'm getting errors. Is there some work around it, to detect click?
This will be a great feature if react native team can add it in the future. Currently this is still an open issue https://github.com/facebook/react-native/issues/586
Somebody provide a suggestion at there you can give it a try. But it is better wait for facebook team to provide a more elegant solution.
Any events taking place inside a webview is sandboxed from the rest of the application. This is by design of this native component, not a limitation of React Native.
What you will need to do is to manually bubble up the event that you are interested in from the webview to your app yourself.
You can currently do so by using react-native-webview-bridge. You set a global listener to the DOM event that you are interested in. Once you catch it, you send it to your application via the bridge.

Multiple page native flow using WL.NativePage.show?

I have instrumented a native iOS application with the Worklight API's and it functions properly.
However, when I start with a Hybrid application and transition to native using WL.NativePage.show() I can only see the first native page. Buttons on that page are clickable but I am not sent to the next native page. I added [NativePage showWebView:returnedData] to one of the buttons and I am returned successfully to the hybrid app.
So my question is simply, once I go into native code I should be able to continue in native until I call the NativePage function, correct?
This is an iOS application on MFP 7.0 and when I click the native buttons I get no messages in the console.
WL.Nativepage.show is very limited and problematic when it comes to added more and more native functionality, esp if you add more classes and start interacting between them. That is because it is not properly set in the viewcontrollers stack.
It was meant to be a single page where you do native interaction only in it and no more.
Since you're using MFPF 7, you should have the Send Action API, which give you full control over what you'll be able to do when using native code in your Hybrid application.
You can see an example here: Integrating a Worklight-based iOS app with Xcode Storyboard
Read more about it here: Sending actions and data objects between JavaScript code and native code
Basically, after you send an action to the native layer of the application, you create your own classes (rather than use MFP's WL.NativePage.show API) and thus you control the entire flow.

Modal Application

I'm using Xamarin.Android and I would like to build an application that start in modal way and don't close if you push the home button.
So this application need to be the only one application than a user can use on device.
Somebody can suggest how it can be done?
You best way to do is to make a "Launcher"/"Home" application. The Android SDK comes with a sample on how to do this.
You basically do this by adding your main Activity to the android.intent.category.HOME and android.intent.category.DEFAULT category and you set the launchMode to singleInstance.
This will register it as a Home application, then when you press your home button it should ask you to choose which launcher you want to use. You will have to set it once and it can be changed by the user.
You can find the sample in: android-sdk\samples\android-17\Home\src\com\example\android\home (should also be available in the other API samples).
You cant stop people from installing applications on android devices. You would have to build your own hardware for that however, you can override OnKeyTouch and check for the key being home.
You could build a service that checks the package of each running application and log which applications are run on the device to prevent users from using company property on other things. However, if android ever decides to kill your application the service should stop and this wont work.
Long story short what you are trying to do is flawed in its inception given the platform you are trying to do it on.

Call Javascript function in background task in iOS

I have a phonegap app and I want to execute Javascript code in a background task. When the application enters background I start executing a javascript function which takes data out of a web database and sends some values to a web service, the returning data may toggle a push-notification to the user.
I found either how to call javascript from Objective-C here on Stackoverflow and how to implement Long-Running Background Tasks in the iOS SDK Documentation pages, but I haven't found anything in combining both (what I think is e.g.: When I invoke javascript code via a webview, does this View even exist when the App is in background?) so I want to ask some more experienced iOS Developers if this is even possible.
I don't think its really possible. Javascript requires a UIwebview to run (in realtime) and must be visible to the user. When an app is put in background only a small amount of tasks are allowed to run- webview not one of them.
Your better off sending your data to a web server that runs a cron-job or similar to send out a push notification via apples push notification server - You can also bypass this and use a service like http://urbanairship.com/
I experimented with this on iOS 5+ and it's possible. I created a small PhoneGap plugin that demonstrates how this works. Check it out, and see the README for most of the info.
https://github.com/jocull/phonegap-backgroundjs

Resources