[solved] question Create file and save it is possible and check conection


#1

I have a question, and can create and save a file locally alert the plugin cordoba or ionic and can not do such a thing?


#2

i have soluve problem use localsotorage, but its but I wonder if it was possible to make the save file alert program
Also I leave here the link where giei me, that I find very interesting and easy to understand


#3

Ionic is built on top of cordova, look into the File API implementation plugin(s)…

http://dev.w3.org/2009/dap/file-system/pub/FileSystem/
http://cordova.apache.org/docs/en/3.5.0/cordova_plugins_pluginapis.md.html#Plugin%20APIs
http://cordova.apache.org/docs/en/3.3.0/cordova_file_file.md.html#File

and here for how to install the plugin…

http://cordova.apache.org/docs/en/3.5.0/guide_cli_index.md.html#The%20Command-Line%20Interface


#4

@andmar8 Tanks for help and enlightenment, not wanting to abuse too, will be you can give me a hand here in the implementation of network information-plugin? The thing is, I have the plugin installed

but the app crash, gets the whole white screen, the code I am using and how is the example:

angular.module('agendaCD.controllers', [])


.controller('AppCtrl', function($scope) { 
	$scope.main = {};
    $scope.main.dragContent = false;
	
	$scope.allowSideMenu = true;

function checkConnection() {
    var networkState = navigator.connection.type;
    var states = {};
    states[Connection.UNKNOWN]  = 'Unknown connection';
    states[Connection.ETHERNET] = 'Ethernet connection';
    states[Connection.WIFI]     = 'WiFi connection';
    states[Connection.CELL_2G]  = 'Cell 2G connection';
    states[Connection.CELL_3G]  = 'Cell 3G connection';
    states[Connection.CELL_4G]  = 'Cell 4G connection';
    states[Connection.CELL]     = 'Cell generic connection';
    states[Connection.NONE]     = 'No network connection';

    alert('Connection type: ' + states[networkState]);
}

checkConnection();


I already walked a search and found another example that was as follows:

if(navigator && navigator.connection && navigator.connection.type === 'none') 
{
     alert("no conection");
}
else
{
     alert("connection");
}

but, whenever I have the link, impremi value, and the result is always 0 (navigator.connection.type)
once again, thanks for assisted provided


#5

The first thing to check with cordova plugins is… are you waiting for device ready?

Nothing in cordova will work properly otherwise:

http://cordova.apache.org/docs/en/3.5.0/cordova_events_events.md.html#deviceready

All code related to cordova and plugins MUST come after the device ready event.


#6

I’m so dumb … did not have the line

document.addEventListener ("deviceready" onDeviceReady, false); 

thanks again @andmar8 the available time and the help