简体   繁体   中英

Android phonegap/cordova app works in emulator but not on phone

I'm currently working on a phonegap/cordova 3.0 application with some friends which is supposed to have functionality which allows it to store reminders for future events and remind users when these events are approaching. I have installed the localNotification plugin (by Sebastián Katzer) in the phonegap app via the command line. I have cut my code down to a minimum and when it is run on an emulated device on my computer it works fine (Its just supposed to make a notification appear in the notifications tray at the moment) but when I install the app on a phone it doesn't work (it doesn't throw any errors either). Here's my code I'd appreciate if anyone could give me any help/advice!

<html>
<head>
    <title>Test Storing Events</title>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>

    <script>
    function addEvent()
    {
        window.plugin.notification.local.add({ message: 'Great app!' });
    }
    </script>
</head>
<body>
        <h1>Apache Cordova</h1>
        <input type="button" onclick="addEvent()" style="width: 100px; height: 100px;" value="Click me">
</body>

Hopefully this isn't too late. I have had problems with this plug-in recently. To start with, look in logcat (I assume you have the Android tools installed so can run "adb logcat" at the command line). You will probably find Android is logging that no icon has been specified. Older versions of Android chose one anyway but the version I had at one point (4.3 possibly) would simply beep and log the error.

Just try an earlier version of this plugin by specifying the version number in the config.xml setup. "version="0.7.0" works for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM