IBM Worklight 6.0 - WL.Client.Push.subscribe callbacks not fired - android

I am having issues with push notifications on Android,
My main issue is that WL.Client.Push.subscribe is called, then neither success or failure callback is called.
if (WL.Client.Push){
WL.Client.Push.onReadyToSubscribe = function(){
alert("onReadyToSubscribe");
if (isPushSubscribed() == false) {
doSubscribe();
}
};
}
function doSubscribe(){
alert("doSubscribe");
WL.Client.Push.subscribe("myPush", {
onSuccess: doSubscribeSuccess,
onFailure: doSubscribeFailure
});
}
function doSubscribeSuccess(){
WL.Logger.debug("doSubscribeSuccess");
alert("doSubscribeSuccess");
}
function doSubscribeFailure(){
WL.Logger.debug("doSubscribeFailure");
alert("doSubscribeFailure");
}
This code was working well few days before, and I recently changed my Android package name and my android displayed name (and also the used api key and project number in application descriptor).
Can this be a Worklight issue? Is it normal to not have any failure or success callback?
I also tried to debug with remote inspector (WEINRE) and there is no javascript error causing this behaviour.
Does any one have an idea why this occurs?
Is there something wrong within my code?
Edit:
I tested again my iOS version, and it's working fine. For Android, I am still having this issue.
onReadyToSubscribe is fired only at app launch on android, but not after user login.
in iOS it is fired after app launch (without subscribe failure or success callback) and also after login (with working subscribe callback).
Edit 2:
in android logs, I can see when I login :
W/CordovaPlugin(26319): Attempted to send a second callback for ID: Push924901903

Are you getting onReadyToSubscribe callback? Log?

Related

Application restart on video capture callback with cordova-plugin-media-capture

I have been using the cordova-plugin-media-capture plugin for some time now without any problems on Android and iOS.
Except under Android 9 or after closing the camera (with or without video to return) the webview restarts.
I searched everywhere in the github issues of the plugin and on this forum but without success...
I also have trouble understanding what's happening with the logs because as soon as the application restarts I have the process that switch to "DEAD" status and so I no longer have the logs in Android Studio.
I may have help with
https://developer.android.com/about/versions/oreo/android-8.0-changes#back-all
or https://developer.android.com/about/versions/pie/android-9.0-changes-28
I would like to point out that this does not work even if I disable battery optimization from the parameters.
Here was the code I use :
var captureSuccess = function(mediaFiles) {
// didn't reach this code
}.bind(this);
var captureError = function(error) { };
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1, duration:60});
Did you have any ideas?
EDIT 1 :
At the end of the README of cordova-plugin-media-capture we can read this :
When capturing audio, video, or images on the Android platform, there
is a chance that the application will get destroyed after the Cordova
Webview is pushed to the background by the native capture application.
I'm affraid about it cause i use ExtJS framework which are unable (or i don't know how) to save and restore state at the resume event...
Do you know how to avoid the apps to be destroyed ?
Sir, same problem with me
tried everything other than searching in forums :)
but i think it is a issue with cordova only,
tried this
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1, duration:60});
but there is now acceptance (right tick/ accept this) to invoke call the onSuccess function from the UI after capture options work perfectly
Successfully worked on Android 6,7,8 on emulator
but getting error on android 9 on personal mobile device (nokia 6.1)
Hoping you have this issue if possible....
getting this error after catching error on console after pressing back after recording video
{code: 3, message: "Canceled."}
code: 3
message: "Canceled."
proto: Object
hope somethings gets resolved...

aprirtc call_crossing_detected error when calling from android to android

My ionic angularjs corodova app works great when receiving calls from the demo web page on chrome. When I try to initiate a call to the demo site or another device, whether using demo API key or real api key, i get
call_crossing_detected
What does this mean, and how do you fix it?
More details on symptoms. When this occurs, no video comes up and the initiating device shows the error and the call button remains. But the receiving device switches to the hangup button, which then works. And if you speak into either device the receiving device receives the audio, but nothing on the initiating device
"call_crossing_detected" reason appears on hangup event when a call is already established between the two users and you are trying to establish a new one.
So I think you may have an issue on the first call hangup.
I have resolved this issue. It was caused by apiRTC.init executing more than once.

Custom receiver connection failed

I have an Android app, working with a custom receiver. It was working without problem, but with the release of the new cast companion library, I decided to upgrade it, as well as my Play services version.
Anyway, when I try to connect to Chromecast, my custom receiver HTML page is displayed. But then, I can't connect and send data to it. After a while (something like 15 seconds), the app exits on the Chromecast.
Then, I've tried to get the Cast Hello Text sample to work, using the same app id. Same problem here.
Here is the code I use to launch the Cast app:
Cast.CastApi.launchApplication(mApiClient, getString(R.string.app_id), true)
The result I receive in the ResultCallback, is a status with code 15, with isSuccess method returning false.
The problem doesn't seem to come from my Chromecast, since other users have the exact same issue.
Thanks for your help!

Server calls hang forever, only on android *built* app

My app works perfectly:
On browser, both locally and deployed
On emulator, using either the local or deployed server
On my device when using run android-device, using either the local or deployed server
But somehow, when I build it following these instructions, at the first server call, for example:
console.log("test1");
Meteor.call("someMethod", function (error, result) {
console.log("test2");
});
// yes I know how asynchronous calls work
console.log("test3");
Or:
console.log("test1");
Meteor.loginWithPassword("validUsername", "validPassword", function (error, result) {
// should print no matter if the credentials are good or bad anyway
console.log("test2");
});
console.log("test3");
"test2" does not get printed in the adb logcat, even though "test1" and "test3" do. There is a mapbox map that loads fine, so it's not an internet access issue. Also, startup works:
Meteor.startup(function () {
console.log("this gets printed in the adb console");
});
So it's not ALL Meteor methods. I used both my deployed and local server: there were no errors reported on the server log. I also tested hot-code push on my local server, it does reload the app on my phone! But only the first time I launch the app only after it's freshly installed. Still, there is at least some kind of connection between them.
I should also mention that I already built this app and it worked fine before, but I did not build it in a while and now it doesn't work anymore. I installed the package on two different devices and get the exact same issue.
Here is my package list if it can help, all on the latest version available:
meteor-platform
iron:router
sacha:spin
accounts-password
accounts-base
mdg:geolocation
mrt:flash-messages
mdg:camera
useraccounts:ratchet
fastclick
alanning:roles
tap:i18n
simple:imgur
Here are the client's logs when I launch it on my local server:
I/CordovaLog(18991): Changing log level to DEBUG(3)
I/CordovaLog(18991): Found start page location: index.html
D/CordovaLog(18991): file:///android_asset/www/meteor_cordova_loader.js: Line 12 : METEOR CORDOVA DEBUG (meteor_cordova_loader.js) Error reading version file Error: Failed to resolve entry: file:///data/data/com.idz9099616fhad1150nrz/files/meteor/version
D/CordovaLog(18991): file:///android_asset/www/meteor_cordova_loader.js: Line 12 : METEOR CORDOVA DEBUG (meteor_cordova_loader.js) Couldn't load from the manifest, falling back to the bundled assets.
D/CordovaLog(18991): file:///android_asset/www/meteor_cordova_loader.js: Line 12 : METEOR CORDOVA DEBUG (meteor_cordova_loader.js) Loading from url: http://meteor.local
D/CordovaLog(18991): http://meteor.local/d7372e9a56ce9d5ddfb0fea0d5e071cfd699fac8.js: Line 111 : show showSignInLink signIn
These are all before I hit "Sign In" on my app. That last statement is just a log print from the useraccounts:ratchet package that occurs everywhere. As soon as I hit "Sign in": blank page, and zero output on the logs. (that's due to the fact that I can never actually stop logging in, as we saw earlier) The above log remains as it is forever.
When using the app installed with run android-device, it's the same exact output, except that after I click, the next page shows up and everything works fine. (logging works, as everything else) As with the non-functionning app, no more log lines show up. (except when I start using the app as usual)
What really bugs me is that it works perfectly fine on my phone when I install the app using run android-device. Even when I stop the debug and use this build as a standalone app, it works flawlessly! But I cannot decently ask users to install my app using meteor run, can I?
From the information you've provided it looks like you have a race condition issue in your code. I'm not assured this is what it is, but the characteristic of the problem you're describing makes it quite likely.
On your local server it doesn't pop up because the connection is fairly instantaneous, but on a remote server it's more of an issue since the data may not yet be ready due to the higher latency.
Basically you have something like this in your code, or a variation in some way:
var doc = MyCollection.findOne();
return doc.name
The thing is MyCollection.findOne() is null (since the data has not yet loaded). This calls up a cannot read 'name' of undefined error (client side not server side) and this halts the execution of further code, which is why your screen is white and the subscriptions aren't run.
How to find where this is exactly. Try and get access to adb to view the client side logs on the device or view and login with xxx.meteor.com/your deployed server on your web browser and keep an eye on the JS console to find where it pops up. The key thing to reproduce the issue is a slower connection to the server than that available on your localhost
The fix is simply accounting for a lack of data, i.e return doc && doc.name instead of return doc.name or if(doc != null) return doc.name;

IBM Worklight 6.0 - busy indicator doesn't always close on Android

I am using WL.BusyIndicator with an adaptor call in Worklight 6.0:
this.busyIndicator.show();
WL.Client.invokeProcedure(invocationData, {
onSuccess : function(response) {
this.busyIndicator.hide();
// do good stuff
}.bind(this),
onFailure : function(err) {
this.busyIndicator.hide();
WL.SimpleDialog.show("Adapter Error", JSON.stringify(err), [{text: "OK"}]);
}.bind(this)
});
This usually works, but on Android, when the adapter call fails (the worklight server is stopped) I will sometimes see the "Adapter Error" dialog, and when I dismiss it, the busyindicator is still there. At this point my app is dead, as there is nothing that I can do with the busyindicator running. (back button does not clear it)
There is nothing in the logcat other than the error message about the adapter call failing.
I've see this in the emulator on Android 4.1.2 and 4.2.2, and on a 4.1.2 phone. I wasn't able to reproduce it in the Android 2.2 emulator, but that runs so much more slowly, it may just be a timing window I can't hit there. I haven't seen the problem on iOS or in Chrome.
Has anyone else seen this?
We have encounter similar problems in 5.0x version. We ended up creating a Busy Indicator manager and implemented a time out that would eventually close the indicator. We then directed all calls through this manager.
I have something missing here...
Why are you using the BusyIndicator in the form of this.busyIndicator.show()?
Did you initialize your own busyIndicator? Try creating one of your own and then use it in the form of, for example: mybusy.show() and mybusy.hide().
I have seen this issue with 6.0 and 6.1. I did initialize in wlCommonInit. Since we were using jquery I decide to switch to the jquery loader and seems to work as I expected the busyIndicator would work. Only issue is you do lose the native loading but this was something I had to get passed.
$.mobile.loading( "show", {text: "foo",textVisible: true,theme: "z",html: ""});
$.mobile.loading( "hide");

Categories

Resources