katzer/cordova-plugin-local-notifications

Crosswalk compability

MaZZly opened this issue · 79 comments

With crosswalk it doesn't compile if localnotification plugin is used.

APP/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java:473: error: cannot find symbol
                    webView.evaluateJavascript(js, null);
                           ^
  symbol:   method evaluateJavascript(String,<null>)
  location: variable webView of type CordovaWebView
APP/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java:470: error: cannot find symbol
        webView.post(new Runnable(){
               ^
  symbol:   method post(<anonymous Runnable>)
  location: variable webView of type CordovaWebView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileArmv7DebugJava'.

I can get rid of compilation errors by removing the sendJavascript function in LocalNotification.java:463
and replacing the 2 calls to it (:419 & :454) with webView.sendJavascript(js);

Then it will compile.. Then when calling cancelAll() or scheduledIds() (And maybe others) the app crashes and output is:
[ERROR:runtime_javascript_dialog_manager.cc(69)] Not implemented reached in virtual void xwalk::RuntimeJavaScriptDialogManager::WebContentsDestroyed(content::WebContents*)

Ideas?

I can confirm this issue too. Any idea?
Btw., MaZZly's workaround works for me also.

same here!

I'm receiving same error in Apache Cordova Android 4.0.0

/home/danail/git/app/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java:495: error: cannot find symbol
                    webView.evaluateJavascript(js, null);
                           ^
  symbol:   method evaluateJavascript(String,<null>)
  location: variable webView of type CordovaWebView
/home/danail/git/app/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java:492: error: cannot find symbol
        webView.post(new Runnable(){
               ^
  symbol:   method post(<anonymous Runnable>)
  location: variable webView of type CordovaWebView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/danail/git/app/platforms/android/src/org/apache/cordova/file/ContentFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
 FAILED

According to http://cordova.apache.org/announcements/2015/04/15/cordova-android-4.0.0.html, new Android uses first-class support for Crosswalk

same here

Not sure if the issue is about crosswalk or the new cordova release that is building with Gradle instead Ant

local-notification plugin will support Cordova 4 and Crosswalk starting with v0.9

Can you say when? I'm not trying to rush you, I'm asking because I have a project that is using crosswalk and I'm wating this release

I'm also running into this, any timeline on 0.9?

I am also running into this same issue. When do you think 0.9 will be out please ?

Same problem here, I would like to use this plugin with Crosswalk

I have the same problem with cordova 5.0.0

I have the same problem with cordova 5.0.0

+1

+1, same problema with cordova 5.0.0 and android platform version 4.0.0

+1

+1, i also have same issue with cordova 5.0.0 and cordova android platform 4.0.0

Durss commented

is it really necessary to say i have the same problem..? :p

EDIT : This branch worked for me :)
https://github.com/DarianLewin/cordova-plugin-local-notifications/tree/issue-535-quick-fix

+1 Crosswalk on Cordova@5.0

+1

+1

Having the same issue without crosswalk

Why this issue was closed?

I am having similar issue with phonegap 4.

screen shot 2015-05-25 at 9 27 29 am

This is the issue I get when I try to compile it.

same problem here :(

/cordova/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java:495: error: cannot find symbol
webView.evaluateJavascript(js, null);
^
symbol: method evaluateJavascript(String,)
location: variable webView of type CordovaWebView
/Users/sharif/Desktop/android-project/cordova/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java:492: error: cannot find symbol
webView.post(new Runnable(){
^
symbol: method post()

same here.
+1

use webView.getView().eva... this should solve your problem.

I got a temporary solution. Hope it works ---

webView.getView().post(new Runnable(){
         public void run(){
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
              webView.sendJavascript(js);
            } else {
              webView.loadUrl("javascript:" + js);
            }
       }
 });

HaPpY CoRdOvIaNs :)

Well the fix makes the project compile.. But when calling the localnotifications functionality the app crashes so it's not really a solution...

+1 same here, no matter what the fix

+1 crosswalk compat. would be nice

+1
same here

+1 Yes please.

canda commented

+1

dfq commented

+1

I forked one a working versions with crosswalk and removed the events that were crashing the app (basically everything trying to callback to Cordova). Unfortunately I am not into Cordova that much yet so I can implement it correctly.

You will not be able to hook into events, like cordova.plugins.notification.local.on("click", callback .. ).
It works for what I need. Perhaps it's enough functionality for some of you until it's fully implemented upstream.

https://github.com/sebasi/cordova-plugin-local-notifications

Cheers, Seb

+1 :(
I don't use cordova-plugin-local-notifications but I began to use crosswalk
I found it after updating cordova to 5.0.0 and android sdk to 22

+1 - I'm using Cordova 5.0.0.

canda commented

I think it is a cordova 5 issue. As stated here #535
I solved this way
I changed LocalNotification.java
both
/plugins/de.appplant.cordova.plugin.local-notification/src/android/LocalNotification.java
/platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java
replacing the function in line 554 with

private static synchronized void sendJavascript(final String js) {

    if (!deviceready) {
        eventQueue.add(js);
        return;
    }
    webView.getView().post(new Runnable(){
      public void run(){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
          webView.sendJavascript(js);
        } else {
          webView.loadUrl("javascript:" + js);
        }
      }
    });
    // webView.post(new Runnable(){
    //     public void run(){
    //         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    //             webView.evaluateJavascript(js, null);
    //         } else {
    //             webView.loadUrl("javascript:" + js);
    //         }
    //     }
    // });
}

Agree with @canda, this is really a Cordova 5/Cordova Android 4 issue, not necessarily crosswalk issue. His fix does work (no runtime errors I have seen yet), just need to also delete this jar to fix the compilation error: platforms/android/libs/android-support-v4.jar

Do the notifications work with the fix proposed by @canda ?

On Thu, Jun 18, 2015 at 9:47 AM, Dan J notifications@github.com wrote:

Agree with @canda https://github.com/canda, this is really a Cordova
5/Cordova Android 4 issue, not necessarily crosswalk issue. His fix does
work (no runtime errors I have seen yet), just need to also delete this jar
to fix the compilation error: platforms/android/libs/android-support-v4.jar


Reply to this email directly or view it on GitHub
#426 (comment)
.

@bradmartin yup, just finished checking my app, notifications come in with all of the properties

@danda1man thanks! I'll use the fix then. Big thanks to @canda for the code.

Shouldn't be created a pull request to fix this, and create a new tag in the repository to be used with cordova 5?

Thank you @canda! for the code snipped. It all works now.

This Should really just be updated in a PR

not working i have a error cannot resolve method in this line webView.evaluateJavascript(js, null)

+1

+1

@canda fix works :)

+1

+1

csvan commented

+1

  • 1

+1

Hi had a compliation error with @canda`s fix due to the method sendJavascript expecting only one argument and not the 2nd null parameter that was still left there.
I've forked it and fixed it. if anyone is interested:
https://github.com/moshetet/cordova-plugin-local-notifications

@canda's solution +1

@canda thank you so much your solution worked for me :)
@sharifbdp thank you too for half solution;)

+1
We need a new release :P

how to end schedule notification after particular time(2 hours)??

+1

+1

Call native app from a web application and then get this error while tabbing back ....
[ERROR: runtime_javascript_dialog_manager.cc(69) ] Not implemented reached in virtual void xwalk::RuntimeJavaScriptDialogmanager::ResetDialogState(content::WebContents*)

@darchanjo I am not surprised that sebasis's plugin compiles, since the relevant lines are just commented out: https://github.com/sebasi/cordova-plugin-local-notifications/blob/master/src/android/LocalNotification.java#L552
I would be surprised if the actual notifications fire through...