liferay / liferay-mobile-sdk

Other
47 stars 56 forks source link

No JSON web service action with path /push-notifications-portlet #32

Closed phancox closed 8 years ago

phancox commented 8 years ago

When attempting to send from Push Portlet receive on Tomcat logs: No JSON web service action with path /push-notifications-portlet.pushnotificationsdevice/send-push-notification and method null for push-notifications-portlet

When device attempts to register receive on Tomcat logs: No JSON web service action with path /push-notifications-portlet.pushnotificationsdevice/add-push-notifications-device and method null for push-notifications-portlet

Not sure if the is relevant, but when listing the JSONWS APIs, it appears that the context should be "pushnotifications" not "push-notifications-device"?

Running Liferay CE 7.0.1 GA 2

Also, should I be using compile 'com.liferay.mobile:liferay-screens:1.4.+' or compile 'com.liferay.mobile:liferay-push:1.0.7' or both as a dependency in the app "gradle.build"?

Following the instructions at https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/using-liferay-push-in-android-apps the video uses dependency 'com.liferay.mobile:liferay-screens:1.1.+' but the example on the page appears to use dependency 'com.liferay.mobile:liferay-push:1.0.7'

Also class AbstractPushActivity appears to be gone from latter versions of the screens library (1.4), perhaps replaced with PushScreensActivity?

javiergamarra commented 8 years ago

There is an error with the urls of the push portlet (in GA2) & the push library.

It's fixed in latter versions of Liferay 7.0.x and in liferay-push:1.1.0.

We have released Screens 1.4.1, a hotfix version fixing several minor issues and including support for liferay-push 1.1.0... normally you could use a newer push version and an older screens version at the same time but in this case push needs to specify the liferay portal version to call one service or other.

The modifications in the portal are more problematic but only affect the test-tab url of the portlet. You could build a newer version, await for the GA3 (it was fixed a week ago) or I can send you the newer jar version.

Yes, AbstractPushActivity was renamed to PushScreensActivity.

phancox commented 8 years ago

Thanks for the quick response. Would be great if you can send me the newer jar version. Can you attach it here?

Since I've made my dependency 'com.liferay.mobile:liferay-screens:1.4.+', would I have already picked up version 1.4.1?

javiergamarra commented 8 years ago

I attach the jars for the new version.

I would specify the 1.4.1 (at least momentarily) because I don't know when gradle decides to check if there are new versions available. I don't think it does it every time the build is launched but I'm not sure...

push-jars.zip

phancox commented 8 years ago

Thanks. Not sure how to deploy these though? Can only find some similiar unpacked content in Tomcat's work directory.

Can I just deploy through upload to App Manager? Not familiar with the OSGI stuff yet (if that's applicable).

THANKS

javiergamarra commented 8 years ago

You can drop them in the deploy folder as you would deploy a war file.

I suppose that they should also work via the app manager :)

Javier Gamarra Mobile Developer

On Tue, Aug 2, 2016 at 2:46 PM, Peter Hancox notifications@github.com wrote:

Thanks. Not sure how to deploy these though? Can only find some similiar unpacked content in Tomcat's work directory.

Can I just deploy through upload to App Manager? Not familiar with the OSGI stuff yet (if that's applicable).

THANKS

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/liferay/liferay-mobile-sdk/issues/32#issuecomment-236893116, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUyrfYAmFHrL0AggnUTkKZie3USI_b4ks5qbzw3gaJpZM4JagkS .

phancox commented 8 years ago

Not having much luck with this. Lots of work cleaning out the old modules but getting the following error, which I presume is stopping the portlet showing up under the configuration menu. 23:30:57,760 WARN [fileinstall-/data/liferay/osgi/modules][org_apache_felix_fileinstall:103] Error while starting bundle: file:/data/liferay/osgi/modules/com.liferay.push.notifications.test-1.0.0.jar org.osgi.framework.BundleException: Could not resolve module: com.liferay.push.notifications.test [45]_ Unresolved requirement: Import-Package: com.liferay.arquillian.extension.junit.bridge.junit_ [Sanitized]

At least the Android part seems to be working. And I think I had to explicitly specify 1.4.1

javiergamarra commented 8 years ago

Uhm... that's the test jar of the portlet but should not prevent the web (com.liferay.push.notifications.web-1.0.4) of deploying... is there any more errors in the log? I suppose you have restarted... can you connect with the OSGI console and check the status of the bundles?

Just do in the terminal 'telnet localhost 11311' and then 'ss | grep push'

phancox commented 8 years ago

Are you able to continue this chat on the #liferay IRC node?

phancox commented 8 years ago

Not sure if you dropped out of IRC but all working now. Many thanks for all your help.

javiergamarra commented 8 years ago

Sorry, phone call, I'm glad everything is ok now. I'll be around the forums if you need help :)

phancox commented 8 years ago

Just resumed work on this and not having much luck. Device is registering with the portal and the portal is sending a test message successfully (or so it says). No messages on the Tomcat logs.

I have a debug statement in the "onPushNotificationReceived()" method but it isn't called. Not sure how to debug this as the message just seems to vanish,

Reading up on push notifications to Android generally, there is a lot of talk about configuring GCM for the app in the Play Console (not the developer console where we got the key). I'm assuming that nothing was necessary there as my test app is not being set up in Google Play?

Looking on the Google Cloud Platform API Manager Dashboard, it isn't showing any traffic which seems odd. When I try and simulate using curl I get {"multicast_id":5411123184246735078,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"NotRegistered"}]} though this also didn't seem to leave any record on the dashboard.

Thoughts?

javiergamarra commented 8 years ago

Did you define a service and broadcast receiver in your app? Does your phone appears as registered in the portal?

You don't need anything in the play console.

phancox commented 8 years ago

Yes the phone does show as registered in the Portal. Code is based on an article for developing an Android client for Liferay push. I'm only expecting to receive notifications with the app running (for now); so do I need a service and broadcast receiver? Main activity below.

`package com.dtc.liferaypushnotificationdemo;

import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log;

import com.liferay.mobile.android.auth.basic.BasicAuthentication; import com.liferay.mobile.android.service.Session; import com.liferay.mobile.android.service.SessionImpl; import com.liferay.mobile.screens.context.LiferayScreensContext; import com.liferay.mobile.screens.push.PushScreensActivity;

import org.json.JSONObject;

public class MainActivity extends PushScreensActivity {

private static final String TAG = "MainActivity";

@Override
protected void onCreate(Bundle savedInstanceState) {
    LiferayScreensContext.init(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
protected Session getDefaultSession() {
    Log.d(TAG, "getDefaultSession()");
    return new SessionImpl("http://host.domain.com:8080", new BasicAuthentication("xxxxxxx@xxxxxxxxx.xxx.xx", "xxxxxxxx"));
}

@Override
protected void onPushNotificationReceived(JSONObject jsonObject) {
    Log.d(TAG, "onPushNotificationReceived(JSONObject jsonObject)");
}

@Override
protected void onErrorRegisteringPush(String message, Exception e) {

}

@Override
protected String getSenderId() {
    return "xxxxxxxxxxxx";
}

} `

phancox commented 8 years ago

This probably isn't the best place for this discussion, would you prefer to take it onto a forum somewhere?

javiergamarra commented 8 years ago

Yes, you need a receiver and a service even if you want to receive the notification in the activity. The best place to continue is here official forums

phancox commented 8 years ago

Continued at https://web.liferay.com/community/forums/-/message_boards/message/78047821