Software Archive
Read-only legacy content
17061 Discussions

Problem Parsing the Package

Puspad_s_
Beginner
1,244 Views

Hello

My app is for android OS. I included Cordova plugin for push notification from github (https://github.com/appfeel/cordova-push-notifications). and I included PushNotification.js file in index.html. Build complete successfully but when installing apk file, phone says "THERE WAS A PROBLEM WHILE PARSING THE PACKAGE". I tested it on more than one phone I got same error. I do not what exactly the error is because build successful every time. 

I have Intel XDk version 2611 and Cordova CLI version 4.1.2.

Anyone has idea how to fix this?

Thank you.

 

 

 

0 Kudos
10 Replies
PaulF_IntelCorp
Employee
1,244 Views

Do not include that PushNotification.js file... do not follow the manual instructions. When you add a plugin using the XDK plugin manager you are using the "automatic" method. Honestly, I'm not sure why some plugin authors continue to publish a manual install method, it is obsolete and was only necessary with versions of Cordova prior to 3.0, which is almost three years ago, now.

Ignore those manual instructions, add the plugin using our plugin manager. In this case, you could use the "cordova registry" option and add the plugin named "cordova-push-notifications" -- that is its name in the registry. There might be a problem in that this plugin includes a hook script, which may not run on our build system, however, it doesn't look like it does anything useful...

0 Kudos
Puspad_s_
Beginner
1,244 Views

Hi Paul

Thanks for reply. Someone suggested me to use phonegap plugin "phonegap-plugin-pushthen i remove cordova-push-notifications plugin and add this plugin "phonegap-plugin-push" (plugin version 1.4.4) by using cordova registry. . And I am using below code to send sender id to GCM server and expecting registration id in response but I got nothing.

Reference link : "https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/EXAMPLES.md"

 

document.addEventListener("intel.xdk.device.ready", function()
{
    alert("Device Ready called");

//  alert("UUID = "+intel.xdk.device.uuid);
    var push = PushNotification.init({
    android: 
    {
        senderID: "670659827415"
    },
    ios: 
    {
        alert: "true",
        badge: "true",
        sound: "true"
    },
    windows: {}
    });

    alert(push);  ---------------------------> I am getting [object object] here and rest of line is not executing.
    
    PushNotification.hasPermission(function(data) 
    {
         alert("has permissioin");
        if (data.isEnabled) 
        {
            console.log('isEnabled');
        }
    });
 
    push.on('registration', function(data) 
    {
        console.log(data);
        alert(data.registrationId);
        console.log("Registration id = " + data.registrationId);
    });
     
    push.on('notification', function(data) 
    {
        alert('Inside notification');
        // data.message,
        // data.title,
        // data.count,
        // data.sound,
        // data.image,
        // data.additionalData

    });

    push.on('error', function(e) 
    {
        console.log("Error = ");
    });

    alert("last alert");      
     
}, false);

But Unfortunately this code is not working. And I am getting nothing in console.

Please find attachment. 

Suggest me how to fix this.

Thank you.

 

0 Kudos
Puspad_s_
Beginner
1,244 Views

I updated Intel XDk with version 2727 and updated CLI version is 5.1.1. I am using below function again to send sender id

document.addEventListener("intel.xdk.device.ready", function()
{
    alert("Device Ready called");

//  alert("UUID = "+intel.xdk.device.uuid);
    var push = PushNotification.init({
    android: 
    {
        senderID: "670659827415"
    },
    ios: 
    {
        alert: "true",
        badge: "true",
        sound: "true"
    },
    windows: {}
    });

  alert(push);
  console.log(push);
     
   alert('First alert');

    push.on('registration', function(data) 
    {
        console.log(data);
        alert(data);
        alert(data.registrationId);
        console.log("Registration id = " + data.registrationId);
    });
     
    alert('Second alert');
    push.on('notification', function(data) 
    {
        alert('Inside notification');
        // data.message,
        // data.title,
        // data.count,
        // data.sound,
        // data.image,
        // data.additionalData

    });
    alert('Third alert');     
    push.on('error', function(e) 
    {
        alert('Error called'+e.message);
        console.log("Error = ");
    });

    alert("last alert");
     
}, false);

Please check attachment.

how to debug is sender id is posted and check error  response?

0 Kudos
PaulF_IntelCorp
Employee
1,244 Views

You cannot test third-party plugins in the Emulate tab. Please see these doc pages:

Please use the Debug tab to perform this debugging.

0 Kudos
Puspad_s_
Beginner
1,244 Views

All I want is Push Notification only for android. Is it possible push notification can be done without changing configuration on server side(PHP)? I already tried a lot. Can I do it without Using GCM server? Can I call just call piece of code, add plugin(if necessary) and its done? Now I am getting push notification, no matter app is running or closed. Is it possible? If yes, please tell me reference link.

Or If you know any other simple way to do this, suggest me.

Thank you.

0 Kudos
PaulF_IntelCorp
Employee
1,244 Views

If you don't want to create your own push service you'll have to subscribe to one. PushWoosh is a popular one. There are many out there. It's not clear to me what you want to do: app notifications or receive data over the Internet via push notifications.

0 Kudos
Puspad_s_
Beginner
1,244 Views

My app has chat feature. I want to notify user via push notification over the internet.

0 Kudos
PaulF_IntelCorp
Employee
1,244 Views

Then I recommend you find a service to help you if you don't want to put together your own server for the notifications. Go to the Cordova plugin registry (https://cordova.apache.org/plugins/) and you can search for the available options.

0 Kudos
Smith__J
Beginner
1,244 Views

I am having the same problem; I am starting a new project by importing source code. That www folder has the media plugin already, cordova-plugin-media. Should I delete that, and start over, by importing it through XDK?

0 Kudos
PaulF_IntelCorp
Employee
1,244 Views

Yes, you can delete any plugins directory that is in your source directory and add them back using the plugin manager on the Projects tab.

0 Kudos
Reply