The app is built using the ionic framework.
Its been installed on a new device that's using Android 4.4.
Based on this question I used this code to reload the page:
$scope.reloadRoute = function() {
$window.location.reload();
}
This does not appear to work in Android 4.4+
I have tried the other suggestions from that answer, but they do not work for our case.
I tried this:
location.href = location.origin;
It doesn't work. I need it to reload.
Related
I have been trying to create an Ionic Google login popup with Firebase. However, when the user tries to press the login button, the function is called producing a popup that is surprisingly completely blank.
$scope.login = function()
{
baseRef.authWithOAuthPopup("google", function(error, authData)
{
if (error)
{
alert('Hello');
}
else
{
$scope.auth = authData.google;
$scope.user.set("name", $scope.auth.displayName);
$scope.user.set("image", $scope.auth.profileImageURL)
$scope.user.save();
}
});
};
All my permissions in Firebase and Google have been properly set as well as those in the config file. Does anyone have any idea how I can possibly fix this issue to allow a functional popup to spawn?
I had quite a problem with this also.
It appears to work well with iOS, but no luck with android.
By using the command 'ionic state save' followed by 'ionic state restore' ionic readded the android and iOS platforms. It also added cordova-plugin-inappbrowser, cordova-plugin-whitelist (plugins) to the package.json file.
Next, I created an android build using 'ionic package build android' and send it to my OnePlus 2 using TestFairy.
Finally works, for both google and facebook.
In summary once the package.json file included the relevant plugins, I was able to create an APK file that worked with the firebase $authWithOAuthPopup.
(with these amendments, iOS still seems to work fine)
I am currently working on a hyrbid mobile app for windows phone 8.0 and windows phone 8.1 using the cordova framework. There is a scenario where I need to use the in-app browser to launch a login page.
I used the following javascript code .
var authWindow = window.open('http://www.mylogin.com', 'mywindow', 'location=yes,toolbar=yes,clearsessioncache=yes');
Although the window opens fine I am getting null as the reference to the window object here. I need the reference to perform other actions on the opened window.
On further research I found that issue exists in desktop IE11 also and we have to disable the protected mode. Once I did it and ran the code on desktop IE11 it worked fine.
I am not sure how to achieve the same in my scenario. Is there any setting I need to change on the browser control? How do you resolve this?
Open external pages on Windows Phone as a Javascript Mobile App is a real problem. On Android and IOS you just use "windows.open" and you are good to go. But on WP, we will need to create a C# plugin.
On my app, I did the following:
1 - You will need a javascript function that calls the plugin.
Javascript call
function openExternalURL(theURL) {
cordova.exec(function () { }, function () { }, "yourApp.main.plugins.YourPluginClass", "openURLWithNative", [theURL);
};
2 - Now you need to implement a C# class that calls Windows Phone browser with the correct URL. For it, you should create a .cs file (in the example its name is YourPluginClass.cs):
YourPluginClass.cs (C#)
namespace yourApp.main.plugins
{
class YourPluginClass : BaseCommand
{
public void openURLWithNative(string uri)
{
WebBrowserTask task = new WebBrowserTask();
string optVal = JsonHelper.Deserialize<string[]>(uri)[0];
task.Uri = new Uri(optVal);
task.Show();
}
}
}
This way, you can open any external URL on Windows Phone like Android and IOS.
Hope it helps. Best Regards!
There is a few good workaroungs that worked for me in :
Do a window.open("about:blank", "newPage"); before the AJAX call and then after the call add the URL to the opened window by calling window.open("http://google.com", "newPage");.
I developing an app for iOS and Android using PhoneGap 3.4.0 from the command line interface, and want to make use of the BarcodeScanner plugin. The problem is that the scanner does not actually do anything when called by my app. The camera does not come up. By using console.log with Safari developer tools, I can tell that the scan function does exist and is getting called... it just isn't doing anything.
I installed the scanner plugin like this:
phonegap plugin add https://github.com/wildabeast/BarcodeScanner
In the index.html, included the javascripts like this:
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
In config.xml, added this:
<gap:plugin name="com.phonegap.plugins.barcodescanner" />
When I set scanner variable like this it logs that there is a BarcodeScanner, and it does have a function scan, but then when I call the function scan nothing happens. (the camera does not open).
var scanner = cordova.plugins.barcodeScanner;
console.log(scanner) // => BarcodeScanner
This is how I'm calling the scan function:
scanner.scan( function (result) {
... my code here...
} );
Any ideas? I'd really appreciate any help or pointers in how to get the barcodeScanner to work with PhoneGap.
I´m having the exact same problem.
After I updated my App to support arm64 (iPad Air), I ran into this issue.
A work-a-round:
Push the hardware On/Off button.
Turn on the device again.
Try starting the barcodeScanner.
This worked for me - but the App will not leave my desk before the issue has been fixed properly.
The issue now exists on all of my devices (iPad Mini, iPhone 4S, iPad Air).
The problem was that the version from wildabeast was not compatible with PhoneGap >= 3.2.0.
Use this branch instead: https://github.com/phonegap-build/BarcodeScanner
Install with
phonegap local plugin add https://github.com/phonegap-build/BarcodeScanner
To get it to work, I had to create a brand new app, copy the www folder over, and then install the plugin.
Creating a nice little phonegap build for ios at the moment, runs fine in the browser, however, when I compile it in Xcode and run in the simulator the history.back() I'm using doesn't work.
I need the history.back() in order to create a back button on each page in the app.
Does anyone know why this may be the case, or an alternative solution.
More information: phonegap build using ember js
Yes, exactly. In several version iOS, Android ( old), history.back() seem not working. To fix it, you should try this code ( i find it in JQM ## and it working well for all )
var nav = window.navigator;
if( this.phonegapNavigationEnabled &&
nav &&
nav.app &&
nav.app.backHistory ){
nav.app.backHistory();
} else {
window.history.back();
}
I am using PhoneGap Build to wrap an AngularJS project as a mobile app, it uses InAppBrowser to open Facebook/Twitter OAuth page.
My configuration:
Angular 1.0.8
PhoneGap 3.1.0 on PhoneGap Build
InAppBrowser 0.2.3
Tested with hydration enabled and disabled, same result
Here is the code snippet I used:
// This part code is called from click handler of a button,
// this is the only place that used the PhoneGap API.
var ipwin; // Used in somewhere else
document.addEventListener("deviceready", function() {
ipwin = $window.open("some url", "_blank");
$(ipwin).on("loadstop", function(e) {
var url = e.originalEvent.url;
console.log("loadstop: " + url);
// snipped
});
// Below are testing code added while debugging
var test = function() {
console.log("setTimeout test");
};
setTimeout(test, 2000);
test();
}, false);
This works fine on Android 4.0, however on Android 2.3 the loadstop event does not fire. I also tried loadstart and loaderror, none of them fires. More strangely, setTimeout test only appears in console output once instead of twice. Is there any problem in my code?
After some refactor and changes to the app, the problem is mysteriously gone. Not entirely sure but I think it is because some other scripts in the page conflicted with cordova.js.
I was experiencing similar problems with both PhoneGap 3.0 and 3.1 on Android, reverting to PhoneGap 2.9 made these InAppBrowser events fire again.
It looks like to be a problem with the last phonegap/cordova version 3.1.0.
https://groups.google.com/forum/#!topic/phonegap/e5_5unC2fYs
Try an older version.
this issue happened to me and I did these steps to solve it:
Upgrade your Phonegap version to 3.1
Create a new project
Add your platforms then your plugins
Copy your code again back to www
this should solve your problem