Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49186

Ionic not work on android tablet

$
0
0

@totofe wrote:

Hi,

I try to use my app on a tablet. But it doesn't work.
When I lunch my application, I have only a white screen. On android phone it work correctly.

this is my app.js

'Use Strict';
angular.module('App', ['ionic', 'ionic.service.core', 'ngCordova', 'ngCordovaOauth', 'ngStorage', 'ngMessages', 'firebase', 'ionic-datepicker', 'ionic-timepicker', 'monospaced.elastic', 'angularMoment', 'jrCrop']) //, 'ionic.service.push', 'ionic.service.core'
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('menu', {
    url: "/menu",
    abstract: true,
    templateUrl: "views/menu/menu.html",
    controller: 'menuController'
})
.state('login', {
  url: '/login',
  templateUrl: 'views/login/login.html',
  controller:'loginController'
})
.state('forgot', {
  url: '/forgot',
  templateUrl: 'views/forgot/forgot.html',
  controller:'forgotController'
})
.state('register', {
  url: '/register',
  templateUrl: 'views/register/register.html',
  controller:'registerController'
})
.state('menu.home', {
    url: '/home',

    views: {
        'menuContent': {
            templateUrl: 'views/home/home.html',
            controller: 'homeController'
        }
    }
})
.state('menu.contacts', {
    url: '/contacts',

    views: {
        'menuContent': {
            templateUrl: 'views/contacts/contacts.html',
            controller: 'contactsController'
        }
    }
})
.state('contacts', {
    url: '/contacts',
templateUrl: 'views/contacts/contacts.html',
controller: 'contactsController'
})
.state('menu.profiles', {
    url: '/profiles',

    views: {
        'menuContent': {
            templateUrl: 'views/profiles/profiles.html',
            controller: 'profilesController'
        }
    }
})
.state('profiles', {
    url: '/profiles',
    templateUrl: 'views/profiles/profiles.html',
    controller: 'profilesController'
})
.state('menu.editprofile', {
    url: '/editprofile/:editprofile',

    views: {
        'menuContent': {
            templateUrl: 'views/editprofile/editprofile.html',
            controller: 'editprofileController'
        }
    }
})
 .state('editprofile', {
     url: '/editprofile/:editprofile',
    templateUrl: 'views/editprofile/editprofile.html',
     controller: 'editprofileController'
 })

 .state('menu.myevents', {
 url: '/myevents',
 views: {
     'menuContent': {
         templateUrl: 'views/myevents/myevents.html',
         controller: 'myeventsController'
     }
 }
 })
.state('menu.event', {
    url: '/event/:idevent',
    params: { idevent: null },
    views: {
        'menuContent': {
            templateUrl: 'views/event/event.html',
            controller: 'eventController'
        }
    }
})
.state('event', {
    url: '/event/:idevent',
    params: { idevent: null },
    templateUrl: 'views/event/event.html',
    controller: 'eventController'
})
.state('menu.editevent', {
    url: '/editevent/:idevent',
    params: { idevent: null },

    views: {
        'menuContent': {
            templateUrl: 'views/editevent/editevent.html',
            controller: 'editeventController'
        }
    }
})
.state('editevent', {
    url: '/editevent/:idevent',
    params: { idevent: null },
    templateUrl: 'views/editevent/editevent.html',
    controller: 'editeventController'
})
.state('menu.setlocation', {
    url: '/setlocation',

    views: {
        'menuContent': {
            templateUrl: 'views/setlocation/setlocation.html',
            controller: 'setlocationController'
        }
    }
})
.state('menu.messages', {
    url: '/messages/:iduser',

    views: {
        'menuContent': {
            templateUrl: 'views/messages/messages.html',
            controller: 'messagesController'
        }
    }
})
.state('messages', {
    url: '/messages/:iduser',
    templateUrl: 'views/messages/messages.html',
    controller: 'messagesController'
})
.state('posts', {
    url: '/posts/:idevent',
    templateUrl: 'views/posts/posts.html',
    controller: 'postsController'
})
.state('server', {
    url: '/server',
    templateUrl: 'views/server/server.html',
    controller: 'serverController'
})
;
$urlRouterProvider.otherwise("/login");
})
/*
.config(['$ionicAppProvider', function ($ionicAppProvider) {
$ionicAppProvider.identify({
    dev_push: false,
    app_id: 'xxxxxxxx',
    api_key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
});
}])*/

// Changue this for your Firebase App URL.
.constant('FURL', 'https://xxxxxxxxxxx.firebaseIO.com/')
.run(function ($ionicPlatform, $cordovaSQLite, $cordovaGeolocation, geoLocation, $rootScope,$localStorage,  $ionicPopup) {
$ionicPlatform.ready(function () {

    if (window.cordova) {
        var push = new Ionic.Push({
            "debug": true,
            "onNotification": function (notification) {

                var payload = notification.payload;
            },
            "onRegister": function (data) {
                console.log(data.token);
            },
            "pluginConfig": {
                "ios": {
                    "badge": true,
                    "sound": true
                },
                "android": {
                    "icon": "ic_logo",
                    "iconColor": "#ee9425",
                    /*"style": "inbox",
                    "summaryText": "vous avez reçu %n% notification",
                    "payload": {
                            "style": "inbox",
                            "summaryText": "vous avez reçu %n% notification"
                        },
                    "data": {
                        "style": "inbox",
                        "summaryInbox": "inbox"
                    },*/
                    //"Collapse Key": "message",
                    "sound": true
                }
            }
        });


        push.register(function (token) {
            console.log("Device token:", token.token);
            $localStorage.token = token.token;
            push.saveToken(token);  // persist the token in the Ionic Platform
        });
    }
    navigator.geolocation.getCurrentPosition(function (location) {
        console.log('[GEOLOCAL JS1] Location');
    },
function (error) {
    console.log('[GEOLOCAL JS1] error with GPS: error.code: ' + error.code + ' Message: ' + error.message);
});

    $cordovaGeolocation
        .getCurrentPosition()
        .then(function (position) {
            geoLocation.setGeolocation(position.coords.latitude, position.coords.longitude);
        }, function (err) {
            // you need to enhance that point
            $ionicPopup.alert({
                title: 'Ooops...',
                template: err.message
            });

            // geoLocation.setGeolocation(defaultLocalisation.latitude, defaultLocalisation.longitude)
        });

    // begin a watch
    var watch = $cordovaGeolocation.watchPosition({
        frequency: 1000,
        maximumAge: 0,
        timeout: 30000,
        enableHighAccuracy: false
    }).then(function () {
    }, function (err) {
        console.log(err);
        // you need to enhance that point
     //   geoLocation.setGeolocation(defaultLocalisation.latitude, defaultLocalisation.longitude);
    }, function (position) {
        geoLocation.setGeolocation(position.coords.latitude, position.coords.longitude);
        // broadcast this event on the rootScope
        $rootScope.$broadcast('location:change', geoLocation.getGeolocation());
    }
    );

if(window.cordova && window.cordova.plugins.Keyboard) {
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
  StatusBar.styleDefault();
}

if (window.cordova) {
    db = $cordovaSQLite.openDB("my.db");
    $cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS user (id integer primary key, email text, password text, lastUser INTEGER DEFAULT 0)");
} else {
    db = window.openDatabase("my.db", '1', 'my', 1024 * 1024 * 100); // browser
}
  });



})

.run(function(amMoment) {
amMoment.changeLocale('fr');
});

Can you help me?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>