ngcordova

Call a native android app from ionic app

馋奶兔 提交于 2019-12-01 08:56:58
问题 I’m developing an app that will be called by an android native app. I also have to call them. For doing this I found this plugin. They will call my app (and expect me to call theirs) following this code: String packageName = “com.android.app”; Intent intent = getPackageManager().getLaunchIntentForPackage(packageName); if (intent == null) { // The app is not installed intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(“market://details?id=” + packageName)); } intent.addFlags

cordova-plugin-media callback methods

旧街凉风 提交于 2019-12-01 06:28:24
I am using cordova-media-plugin 1.0.1. in an Ionic mobile app. I am using the plugin to play the audio file. I am able to get it to play using: var media = $cordovaMedia.newMedia(fileToPlay, // success callback mediaSuccess, // error callback mediaFailure, // status callback mediaStatus ); I can then call media.play() at it plays the file. However, the callbacks never seem to execute. I have them defined as: function mediaSuccess () { console.log("Successfully finished task."); } function mediaFailure (err) { console.log("An error occurred: " + err.code); } function mediaStatus (status) {

Cordova network isOnline returns true only on WiFi

荒凉一梦 提交于 2019-11-30 10:24:56
The following logs out only when I have WiFi on. On 4g or any mobile internet type it doesn't. Doesn't seem so reliable. Any ideas for a better detection of online/offline state? $rootScope.$on( '$cordovaNetwork:online', function ( event, networkState ) { console.log( "Phone is online" ); } ); This works fine for me: function isOnline(){ return !(Connection.NONE==navigator.connection.type); } I hope this helps you! 来源: https://stackoverflow.com/questions/33878872/cordova-network-isonline-returns-true-only-on-wifi

Cordova network isOnline returns true only on WiFi

我们两清 提交于 2019-11-29 15:31:56
问题 The following logs out only when I have WiFi on. On 4g or any mobile internet type it doesn't. Doesn't seem so reliable. Any ideas for a better detection of online/offline state? $rootScope.$on( '$cordovaNetwork:online', function ( event, networkState ) { console.log( "Phone is online" ); } ); 回答1: This works fine for me: function isOnline(){ return !(Connection.NONE==navigator.connection.type); } I hope this helps you! 来源: https://stackoverflow.com/questions/33878872/cordova-network-isonline

Ionic app image upload from camera / photo library

好久不见. 提交于 2019-11-28 17:36:40
I'm working on a ionic chat app where the user can upload a photo as part of their message. I'm looking for a way to upload the image to my webhost server so I can retrieve it later via a URL. The problem is that I'm not able to get it to upload to my web server. I'm using these two plugins: org.apache.cordova.file-transfer cordova-plugin-camera When I run the app in xcode simulator and select a picture from the device photolibrary, the console gives me the following messages: File Transfer Finished with response code 200 void SendDelegateMessage(NSInvocation *): delegate (webView

Can you use cookies in a Cordova application?

旧城冷巷雨未停 提交于 2019-11-27 23:35:49
I have been building an android app using Ionic. At this point, I am under the impression that Cordova applications do not save or send the cookies that are served from a REST API server. If I run the application with the 'ionic serve' command I can see that my session and CSRF cookies are sent with my AJAX requests. However, when I run the code with the 'ionic emulate' command it does not appear that either are sent to my server. I have seen some articles and threads that talk about using the setAcceptThirdPartyCookies() method in the class that extends CordovaActivity, but that hasn't worked