GithubHelp home page GithubHelp logo

Phonegap v3.x about pushplugin HOT 28 OPEN

mwager avatar mwager commented on September 7, 2024
Phonegap v3.x

from pushplugin.

Comments (28)

jdhiro avatar jdhiro commented on September 7, 2024

I can't even install it via the 3.0 CLI tools =\

Error: grafting xml at selector "plugins" from "/Users/jasonfarnsworth/Dev/MobileClient/platforms/android/res/xml/config.xml" during config install went bad :(
    at /usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:277:47
    at Array.forEach (native)
    at /usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:256:63
    at Array.forEach (native)
    at /usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:235:45
    at Array.forEach (native)
    at Object.module.exports.add_plugin_changes (/usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:231:35)
    at /usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:321:28
    at Array.forEach (native)
    at Object.module.exports.process (/usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:320:49)

from pushplugin.

mwager avatar mwager commented on September 7, 2024

I now got it installed using the following command:

$ plugman --platform android --project ./platforms/android --plugin https://github.com/phonegap-build/PushPlugin.git

However, the Java Plugin (PushPlugin.java) should be modified:

From

import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;

To

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;

I found this by looking at other Phonegap 3.0 JavaPlugins like Device.java.
I don't know if this is the best approach but now I reveive messages on real android devices.

It would be really great if the docs could be updated.

@Hiroio I somehow got around this error by adding following temporary to my android's config.xml:
Also, the plugman outputs lots of errors if files already exist. Trying delete them helped me.

<plugin></plugin>

from pushplugin.

jdhiro avatar jdhiro commented on September 7, 2024

Yeah, it looks like the plugin.xml needs to be updated to avoid installation errors. At a bare minimum...

<config-file target="res/xml/config.xml" parent="plugins"> needs to be <config-file target="res/xml/config.xml" parent="/*">.

Docs are behind on the 3.0 plugin changes, so I'm looking at the core plugins as a reference. I'll try to pull together a pull request for plugin.xml changes.

from pushplugin.

Pragith avatar Pragith commented on September 7, 2024

This error appears on my phone:-

error: Class not found

For Android!

EDIT:
The error shown in Eclipse is:
07-23 15:26:27.720: D/PluginManager(20853): exec() call to unknown plugin: PushPlugin

I observed that the Push plugin doesn't get copied to the \platforms\android\assets\www\plugins unlike other core plugins.
I tried a lot, but I'm very confused because of the directory structure having similar names.

from pushplugin.

mwager avatar mwager commented on September 7, 2024

@Pragith Try adding the following to res/xml/config.xml:

<feature name="PushPlugin">
    <param name="android-package" value="com.plugin.gcm.PushPlugin" />
</feature>

from pushplugin.

Pragith avatar Pragith commented on September 7, 2024

@mwager OMG!
Thanks a lot! It worked. You don't know for how long I've been working on this issue.

from pushplugin.

jdhiro avatar jdhiro commented on September 7, 2024

I just submitted a pull request for Cordova and cordova-cli 3.0 issues -- issue #39.

from pushplugin.

jdhiro avatar jdhiro commented on September 7, 2024

@mwager have you had any luck with iOS? I'm not getting any errors, but the tokenHandler callback never gets fired now.

Edit 1
I'm getting this in the XCode console. I haven't been able to track down the issue yet:

2013-07-23 22:47:46.648 [11370:907] ERROR: Method 'register:' not defined in Plugin 'PushPlugin'
2013-07-23 22:47:46.650 [11370:907] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
  "PushPlugin1385651646",
  "PushPlugin",
  "register",
  [
    {
      "alert" : "true",
      "ecb" : "onNotificationAPN",
      "sound" : "true",
      "badge" : "true"
    }
  ]
]

Edit 2
From reading the 3.0 release notes, it would appear that the old signature of:

- (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options;

has been removed and needs to be replaced with something like

- (void)myMethod:(CDVInvokedUrlCommand*)command;

This is going to have to wait until tomorrow...

from pushplugin.

mwager avatar mwager commented on September 7, 2024

@Hiroio I didn't try with iOS and pg 3.0 yet since I'm focussed on Android only right now. Think I'll wait to see what's going on here...

from pushplugin.

jdhiro avatar jdhiro commented on September 7, 2024

This should all be fixed in my pull request
#39

from pushplugin.

mohan5070 avatar mohan5070 commented on September 7, 2024

I am getting this error after excuted plugman cli and pushplugin.java:

Warning: Ignoring platform 'android-10': build.prop is missing.
Warning: Ignoring add-on 'addon-google_apis-google-14': File not found: manifest.ini

from pushplugin.

jdhiro avatar jdhiro commented on September 7, 2024

@mohan5070 if I had to take a guess, it would be that the v13 support APIs are clobbering the v14 APIs that you apparently already have in your project or something. You probably have to get that sorted out in Eclipse somehow. (Sorry, I'm not going to be of much help there since I've migrated to Android Studio.)

from pushplugin.

mohan5070 avatar mohan5070 commented on September 7, 2024

@jdhiro Thanks. I fixed all the issues.

from pushplugin.

elsigh avatar elsigh commented on September 7, 2024

I had to change the tag in plugin.xml to a jsmodule tag in order to get the CLI prepare function to install the plugin to the proper location.

from pushplugin.

elsigh avatar elsigh commented on September 7, 2024

Also, I had to rewrite the plugin JS itself to fit to the new plugin syntax (i.e. it gets wrapped by the cordova fn and put in cordova_plugins.js)

Should I send in a pull? I think this may break backwards-compat.

from pushplugin.

every25admin avatar every25admin commented on September 7, 2024

Is the issue with tokenHandler callback never gets fired on iOS fixed? I tried latest install from phonegap CLI to download the plugin, but the tokenhandler is still not fired. and no error messages at all.

from pushplugin.

omeriko avatar omeriko commented on September 7, 2024

Guys, is it now safe to use PushPlugin on PhoneGap 3.0 and beyond on Android and iOS ?, what should i do in order to avoid issues?

from pushplugin.

mwager avatar mwager commented on September 7, 2024

If it helps, on this app everything works with the plugin, even with ios7/cordova 3.x..

https://github.com/mwager/atonego

from pushplugin.

neilsh avatar neilsh commented on September 7, 2024

I'd like to reiterate omeriko's question: Is it safe to use PushPlugin with PhoneGap 3.x, and are there any known undocumented caveats?

from pushplugin.

anyandallart avatar anyandallart commented on September 7, 2024

i'm on 3.4 and it's working great for me. installed using CLI: cordova plugin add https://github.com/phonegap-build/PushPlugin.git

from pushplugin.

SteveChadaway avatar SteveChadaway commented on September 7, 2024

I've downgraded to Phonegap 3.4 (20) and still unable to get this plugin working by any method. Everytime I get a class not found error. Anyone any joy or tips?

from pushplugin.

srameshsh avatar srameshsh commented on September 7, 2024

Hi all I have the same issue.Some one can help me see the link: http://stackoverflow.com/questions/24839836/salesforce-android-app-remote-access-application-authorization

from pushplugin.

l-lawliett avatar l-lawliett commented on September 7, 2024

Heh guys am getting Register call but when ever i Click it i get Class not Found I manually add the Plugin and is Deploying on my phone but It says class not Fount what should i do.
look below


Push Notification

<description>
    Push
</description>

<author href="http://cordova.io" email="[email protected]">
    D-Raid
</author>

<access origin="*"/>



<preference name="loglevel" value="DEBUG" />
<!--
  <preference name="splashscreen" value="resourceName" />
  <preference name="backgroundColor" value="0xFFF" />
  <preference name="loadUrlTimeoutValue" value="20000" />
  <preference name="InAppBrowserStorageEnabled" value="true" />
  <preference name="disallowOverscroll" value="true" />
-->

<feature name="App">
  <param name="android-package" value="org.apache.cordova.App"/>
</feature>
<feature name="Geolocation">
  <param name="android-package" value="org.apache.cordova.GeoBroker"/>
</feature>
<feature name="Device">
  <param name="android-package" value="org.apache.cordova.Device"/>
</feature>
<feature name="Accelerometer">
  <param name="android-package" value="org.apache.cordova.AccelListener"/>
</feature>
<feature name="Compass">
  <param name="android-package" value="org.apache.cordova.CompassListener"/>
</feature>
<feature name="Media">
  <param name="android-package" value="org.apache.cordova.AudioHandler"/>
</feature>
<feature name="Camera">
  <param name="android-package" value="org.apache.cordova.CameraLauncher"/>
</feature>
<feature name="Contacts">
  <param name="android-package" value="org.apache.cordova.ContactManager"/>
</feature>
<feature name="File">
  <param name="android-package" value="org.apache.cordova.FileUtils"/>
</feature>
<feature name="NetworkStatus">
  <param name="android-package" value="org.apache.cordova.NetworkManager"/>
</feature>
<feature name="Notification">
  <param name="android-package" value="org.apache.cordova.Notification"/>
</feature>
<feature name="Storage">
  <param name="android-package" value="org.apache.cordova.Storage"/>
</feature>
<feature name="FileTransfer">
  <param name="android-package" value="org.apache.cordova.FileTransfer"/>
</feature>
<feature name="Capture">
  <param name="android-package" value="org.apache.cordova.Capture"/>
</feature>
<feature name="Battery">
  <param name="android-package" value="org.apache.cordova.BatteryListener"/>
</feature>
<feature name="SplashScreen">
  <param name="android-package" value="org.apache.cordova.SplashScreen"/>
</feature>
<feature name="Echo">
  <param name="android-package" value="org.apache.cordova.Echo"/>
</feature>
<feature name="Globalization">
  <param name="android-package" value="org.apache.cordova.Globalization"/>
</feature>
<feature name="InAppBrowser">
  <param name="android-package" value="org.apache.cordova.InAppBrowser"/>
</feature>
<feature name="PushPlugin">
<param name="android-package" value="com.plugin.gcm.PushPlugin" />
</feature>

<plugin name="PushPlugin" value="com.plugin.gcm.PushPlugin" />

from pushplugin.

mwager avatar mwager commented on September 7, 2024

@l-lawliett maybe you should try this:

  1. remove the plugin from all platforms:

    $ cordova plugin rm com.phonegap.plugins.PushPlugin
    
  2. add it again using the cordova add command:

    cordova plugin add https://github.com/phonegap-build/PushPlugin.git
    

from pushplugin.

l-lawliett avatar l-lawliett commented on September 7, 2024

Okay am Gona try that as soon as possible got my mid term coming okay

from pushplugin.

l-lawliett avatar l-lawliett commented on September 7, 2024

@mwager the post above

from pushplugin.

rch84 avatar rch84 commented on September 7, 2024

I am new Git. Can some one provide me steps to apply patch 39 for this plugin in cordova project?

from pushplugin.

srinivasn462 avatar srinivasn462 commented on September 7, 2024

register not defined in PushPlugin.m

  • (void)register:(CDVInvokedUrlCommand*)command;
    {
    self.callbackId = command.callbackId;

    NSMutableDictionary* options = [command.arguments objectAtIndex:0];

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone;
#endif
UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone;

id badgeArg = [options objectForKey:@"badge"];
id soundArg = [options objectForKey:@"sound"];
id alertArg = [options objectForKey:@"alert"];

if ([badgeArg isKindOfClass:[NSString class]])
{
    if ([badgeArg isEqualToString:@"true"]) {
        notificationTypes |= UIRemoteNotificationTypeBadge;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeBadge;
#endif
}
}
else if ([badgeArg boolValue]) {
notificationTypes |= UIRemoteNotificationTypeBadge;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeBadge;
#endif
}

if ([soundArg isKindOfClass:[NSString class]])
{
    if ([soundArg isEqualToString:@"true"]) {
        notificationTypes |= UIRemoteNotificationTypeSound;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeSound;
#endif
}
}
else if ([soundArg boolValue]) {
notificationTypes |= UIRemoteNotificationTypeSound;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeSound;
#endif
}

if ([alertArg isKindOfClass:[NSString class]])
{
    if ([alertArg isEqualToString:@"true"]) {
        notificationTypes |= UIRemoteNotificationTypeAlert;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeAlert;
#endif
}
}
else if ([alertArg boolValue]) {
notificationTypes |= UIRemoteNotificationTypeAlert;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeAlert;
#endif
}

notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationActivationModeBackground;
#endif

self.callback = [options objectForKey:@"ecb"];

if (notificationTypes == UIRemoteNotificationTypeNone)
    NSLog(@"PushPlugin.register: Push notification type is set to none");

isInline = NO;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];
}
#else
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];
#endif

if (notificationMessage)            // if there is a pending startup notification
    [self notificationReceived];    // go ahead and process it

}

/*

  • (void)isEnabled:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options {
    UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    NSString *jsStatement = [NSString stringWithFormat:@"navigator.PushPlugin.isEnabled = %d;", type != UIRemoteNotificationTypeNone];
    NSLog(@"JSStatement %@",jsStatement);
    }
    */

from pushplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.