Tizen: native service not started when launched from a hybrid app - hybrid-mobile-app

There is a Tizen hybrid wearable application: native service and web UI applicatoin.
There is following code to start service from javascript:
tizen.application.launchAppControl(
new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/service"),
"EFdQkhAQ5b.mydemoappliacation",
function() {
console.log("mydemoappliacation service started");
},
function(e) {
console.error("mydemoappliacation failed to start: " + e);
}
);
Everything works well when launch application on SM Gear device. When launch application on emulator - success callback received in JS code, but service not started (no service "main" function invoked).
In case if deploy service as separate application (not in scope of hybrid app) - service starts normally.
Does anyone have any ideas, why service not started on emulator?

Related

How to switch driver context from Android to webview in karate

I'm working on a project to automate a mobile application using Karate and appium. The application that I'm working upon seems to be a hybrid one. When I launch the app it redirects me to a web URL to sign-in(web browser) and my karate tests are not able to locate elements present under the sign-in page.
Feature: android test
Background: App Preset
* configure driver = { type: 'android', webDriverUrl : 'xxxxx', start: false, httpConfig : { readTimeout: 120000 } }
Scenario: android mobile app UI tests
Given driver { webDriverSession: { desiredCapabilities : "#(android.desiredConfig)"} }
And driver.click('//android.widget.Button[#text="Get Started"]')
# Sign details
And click('#signInName')
And input('#signInName', 'someone#gmail.com')
And input('#password', '123456')
karate by default keeps you in the native app context. you can check all the context available by invoking a mobile command,
def contexts = driver.script("mobile: getContexts")
or
json contexts = driver.http.path("contexts").get()
and print contexts
you should be able to switch context to web-view as below (instead of WEBVIEW_1 use your respective web-view which you got from the previous step),
driver.setContext("WEBVIEW_1")
and then switch back to native app by
driver.setContext("NATIVE_APP")
try with different locator strategies if facing any issue

Why is the service worker install event triggered every time i restart my app?

If i navigate from the web app, and no longer have any windows open, when i return back to the app the install event is called every time before activate. This doesn't match the expected lifecycle of install only been called once. I'm not making any changes to the service worker file.
The only code in the service worker is:
self.addEventListener('install', function(event) {
console.log('[ServiceWorker:install] Installing service worker v6.');
});
self.addEventListener('activate', event => {
console.log(`[ServiceWorker:activation] Activating service worker v6.`);
});
That is probably old logs.
You can either clear console or add timestamp to the logs to see that ...installing/...activating messages are logged before you closed/opened the browser window.
Credits to this answer: https://stackoverflow.com/a/41153031/4956536

Using Firebase Authentication from iOS 7.1.2 Safari

I see this error:
Error: This operation is not supported in the environment this
application is running on. "location.protocol" must be http, https or
chrome-extension and web storage must be enabled.
When I use:
firebase.auth().signInWithPopup(provider)
.then(function(result) {
console.log(result);
})
.catch(function(error) {
console.log('popup', error);
//webSettings.setDomStorageEnabled(true);
firebase.auth().signInWithRedirect(provider)
.then(function(result) {
console.log(result);
})
.catch(function(error) {
console.log('redirect', error);
firebase.auth().signInAnonymously().catch(function(error) {
console.log('anonymous', error);
});
});
});
The first two login attempts via popup and redirect fail. It seems to happen only on iOS Safari.
I see others reporting the issue with Cordova, but I don't see an answer and I'm only using web and firebase. Not Cordova or ionic etc.
The anonymous login works on iOS but that is only a test and not what we want to use to use.
If you want to test it you can use https://meetup-reporter.firebaseapp.com/ from Safari on iOS
An example dump of the error object from the returned Promise is:
{"code": "auth/operation-not-supported-in-this-environment",
"constructor": function (a, b)
{this.code="auth/"+a;this.message=b||Xf[a]||"";}, "F": function ()
{return{code:this.code,message:this.message}}, "line": 44, "message":
"This operation is not supported in the environment this application
is running on. \"location.protocol\" must be http, https or
chrome-extension and web storage must be enabled.", "sourceURL":
"https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js",
"stack":
"https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:44:638\nhttps://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:45:258\nA#https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:44:545\nD#https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:45:242\nsignInWithPopup#https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:241:48\na#https://meetup-reporter.firebaseapp.com/__/firebase/4.1.2/firebase-auth.js:260:432\nhttps://meetup-reporter.firebaseapp.com/scripts/main.js:430:36",
"toJSON": function () {var
a=Array.prototype.slice.call(arguments);a:{var
e=Array.prototype.slice.call(a);var l=0;for(var
n=!1,C=0;Cl||l>=fk.length)throw new N("internal-error","Argument
validator received an unsupported number of arguments.");e=fk[l]+"
argument "+(e.name?'"'+e.name+'" ':"")+"must be "+e.N+".";break
a}e=null}}if(e)throw new N("argument-error",d+" failed: "+e);return
b.apply(this,a);}}
signInWithRedirect actually works in Cordova now: https://firebase.google.com/docs/auth/web/cordova
signInWithPopup and signInWithRedirect should also work for iOS7 and up. I just tested both on an iOS 7 device and they both work. What you are experiencing is likely to the fact that you are using this operation in Safari Private/Incognito mode where web storage is disabled. These operations depend on web storage in order to securely communicate the OAuth result to the parent page. You will need to ask your users to switch to regular mode when this happens, or you can use the Google Sign-in JS SDk to get the OAuth credential and then signInWithCredential. I think it may work in incognito mode.

Kurento + Java Spring Client + IOS - Web to IOS communication

We are trying out Kurento 6.0 + Java Spring Client. The Examples works well (one2one call + one2one-recording). We are trying to implement the same functionality on an IOS app so that we can do Peer (IOS) -> Peer (Web) calls. But unfortunately - the documentation is not very clear.
The Kurento Server and Java Spring Boot application are deployed to an AWS ec2 instance and stun servers are configured.
We are using the call https://kurento-IP:8443/call with json to register:
var message = {
id : 'register',
name : name
};
ws.send(message)
And it works!
Question:
How can we now initiate a call in IOS after that?
Should the iOS be communicating to the Spring App (https://kurento-IP:8443/call) or directly to ws://kurento-ip:8888/kurento (We guess should be both?)
On the Web the JS does the following to make a call:
webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options,
function(error) {
if (error) {
return console.error(error);
}
this.generateOffer(onOfferCall);
});
onOfferCall - calls directly the Web!
We were looking into the Kurento IOS documentation, but couldn't yet figure out. How can we convert this into IOS?
Any help would be highly appreciated!
Your iOS app should be sending the messages to the signaling server. I'd suggest you read this small introduction from the documentation, and spend some time understanding where your application architecture fits in this diagram
Hint: It's not the first one ;-)

GCDWebservers background mode not working on device

I'm using GCDWebservers to start a http service. I want it still accept connections in background mode. This is my source code:
func startServer (){
do {
webServer?.stop()
webServer?.removeAllHandlers()
try self.webServer?.start(options: [GCDWebServerOption_BonjourName: "", GCDWebServerOption_BonjourType: IMS_DOMAIN, GCDWebServerOption_Port : IMS_SERVICE_PORT, GCDWebServerOption_AutomaticallySuspendInBackground: false])
} catch {
print("Start server error: ", error.localizedDescription)
}
print("bonjour type", self.webServer?.bonjourType)
}
It works on simulator but on real device its not working. This message printout when App goes foreground again:
dnssd_clientstub read_all(10) DEFUNCT
[ERROR] Bonjour registration
error -72000 (domain 10)
Please help me.
It's not possible to run a web server while your app is in the background (except for the first few minutes at most). See the "GCDWebServer & Background Mode for iOS Apps" section in the GCDWebServer README file for the detailed information:
Typically you must stop any network servers while the app is in the background and restart them when the app comes back to the foreground.

Resources