This is a migrated thread and some comments may be shown as answers.

navigator Objects Are Undefined

13 Answers 392 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Troy
Top achievements
Rank 1
Troy asked on 28 Jan 2014, 11:15 PM
Hi.

Whenever I use the navigator object, all its properties are undefined e.g the navigator.notifications and navigator.splashscreen objects are undefined. I'm using the same exact code from the AppBuilder demo project.

document.addEventListener('deviceready', function () {

// These lines of code don't work
//navigator.splashscreen.hide();
//navigator.notification.alert('Both fields are required', function () { }, 'Login failed', 'OK');

$(document.body).height(window.innerHeight);
}, false);

I've checked other threads and everyone says the navigator object was fixed, but it's not working for me. What can I do to get it working?

13 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 31 Jan 2014, 12:15 PM
Hello Troy,

We could not reproduce this in our local tests and it doesn't seem like anything we've encountered before, most likely a corrupted project (mixed Cordova version?). Try creating a brand new project and moving your existing project files over to it and see how it goes. Also make sure you have upgraded your Visual Studio extension for AppBuilder to the latest version (you can get it from here)

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Josh
Top achievements
Rank 1
answered on 04 Feb 2014, 04:41 PM
I am having the same problem. After updating to the latest release of AppBuilder, the navigator properties are undefined after deviceready.
This can be reproduced by creating a new "Kendo UI Mobile" project. Open app.js and add the following line in beginning of the deviceready callback:
alert(navigator.splashscreen);

Note that this is only happening in the simulator; I installed to a device and it was all working. Is there a recent change to the simulator that we need to account for?

I've attached screenshots of the alert and the simulator debug window.
0
Steve
Telerik team
answered on 07 Feb 2014, 01:15 PM
Hello Josh,

This would start sounding like a template answer, but we could not reproduce this in our local tests, let alone with one of our built-in templates. Can you provide more info about the AppBuilder IDE you're using (Windows Client or VS), the OS version used (whether it is on virtual machine) and everything that you consider relevant.

P.S. Try changing any of the project properties e.g. turn off the Battery plugin, save your app and run the simulator again.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Josh
Top achievements
Rank 1
answered on 07 Feb 2014, 01:38 PM
I've tested with both the VS plugin (2010) and the standalone AppBuilder Windows client. Running Windows 7 Professional SP1 64-bit on a physical machine. The simulator worked nicely before the latest update, even after the change from Icenium to AppBuilder.

How do I turn off the Battery plugin?

The cordova version that is created with a new project is 3.2.0, even though the current version is 3.3.0. Do I have to separately update Kendo/cordova?

Thanks
0
Steve
Telerik team
answered on 11 Feb 2014, 04:46 PM
Hello Josh,

Thanks for the clarification, I've tested with the same configuration but could not reproduce the problem. Are you able to reproduce this exception on any other machine?

Turning ON/OFF (enabling/disabling) an integrated plugin is done through the project properties, see Enable and Disable the Integrated Plugins help article.

The latest official Cordova version is not automatically adopted in Telerik AppBuilder and requires significant efforts and acceptance testing. We usually skip one version of Cordova and update to the next one, so expect an update to 3.4 within a couple of months.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Troy
Top achievements
Rank 1
answered on 13 Feb 2014, 09:30 PM
It was the iceproj file. I updated it by creating a new default Kendo UI Mobile project and copied my files over to it. It's working now. Thanks for the reply.
0
Steve
Telerik team
answered on 14 Feb 2014, 08:20 AM
Hi Troy,

Glad you were able to proceed. My suggestion to turn ON/OFF an integrated plugin should have done automatically what you have done by hand i.e. trigger an update to the .iceproj file, so that it is corrected if it has been corrupted for some reason.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Flavio
Top achievements
Rank 1
answered on 20 May 2015, 11:51 PM
I was having the same problem with the navigator.notification.confirm.... I fixed it by turning on the Notification plugin by going into the Project properties and selecting the tab for plugins. see attached screenshot.
0
Flavien
Top achievements
Rank 1
answered on 05 Oct 2015, 12:45 PM

Same issue, I upgraded the AppBuilder to the latest version and nothing works....

'navigator.splashscreen' is not defined (where it was defined before).

We seriously have no time for that surprise...​

0
Tina Stancheva
Telerik team
answered on 07 Oct 2015, 02:29 PM
Hi Flavien,

Please accept my apology for the inconvenience the latest update of AppBuilder caused in your development process.

Can you try clearing the Device Simulator cache - you'll find it under the %localappdata%\Telerik\BlackDragon folder. Please remove the entire Cache folder and try running your project in the simulator again.

If the issue persists, please submit a support ticket with the following information:
  • AppBuilder logs available under the %localappdata%\Telerik\BlackDragon\Logs
    folder
  • A project where the issue can be reproduced

Also, please let me know if the error messages are only triggered while running the app in the device simulator. I want to make sure they are not thrown when the app is running directly on a device or in a native emulator.

I am looking forward to your reply and I will do my best to help you resolve these issues in the shortest term possible.

Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Flavien
Top achievements
Rank 1
answered on 07 Oct 2015, 03:07 PM

Hi Tina,

This didn't work but Steve's solution is working ok: Turn on the notification plugin. I don't see how this can be related but it worked.

Also, you may be able to help me on something quite important to me. I'm trying to access the SQLite file that is used in my application but the AppBuilder Folder structure doesn't work at all, the folders are all empty (see print screen).  
I changed all the folders in the simultator to test but no luck.

Any clue?

0
Tsvetina
Telerik team
answered on 12 Oct 2015, 09:08 AM
Hello Flavien,

The SQLite plugin works only on devices, so its database file isn't available in the Simulator (see Simulator limitations here).

You can try accessing the SQLite DB file using an app like that one. Or access the DB on the device from your computer using Android Device Monitor, as described in this thread.


Regards,
Tsvetina
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Ricardo de Assuncao Goncalves
Top achievements
Rank 1
answered on 13 Aug 2016, 01:41 AM

Hi,

I fixed this issue about device or navigator is undefined.

The issue started after I updated to the latest version of Appbuilder yesterday. I fixed this issue by uninstalling the Appbuilder extension and installing it again.

- In Visual Studio Go to Tools -> Updates and Extensions

- In the "Installed" tab find the "Telerik Appbuilder" and uninstall it

- In the "Online" tab find the "Telerik Appbuilder" and Install it

It should take no more than 5 minutes to complete...

I looked at the logs folder (%localappdata%\Telerik\BlackDragon\Logs ) and it seems to have an issue when copying the cache folder from one place to another. It cannot find the folder... So don't waste time trying to fix the issue. Just uninstall the extension and install again.

Hope it helps.

Tags
Apache Cordova
Asked by
Troy
Top achievements
Rank 1
Answers by
Steve
Telerik team
Josh
Top achievements
Rank 1
Troy
Top achievements
Rank 1
Flavio
Top achievements
Rank 1
Flavien
Top achievements
Rank 1
Tina Stancheva
Telerik team
Tsvetina
Telerik team
Ricardo de Assuncao Goncalves
Top achievements
Rank 1
Share this question
or