掲示板

Liferay Push in Android Issue

thumbnail
8年前 に Harish Kumar によって更新されました。

Liferay Push in Android Issue

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi

I am trying to implements Liferay Push for Android and followed the video tutorial available on https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/using-liferay-push-in-android-apps.

But I could not make it working. When I am sending test message from liferay, nothing is happening on app.
NOTE: I could not find AbstractPushActivity class in the API, Is it available in the released API. For now I tried by extending PushScreensActivity.

I can see my emulator in devices tab in Push Notifications.

Please find attached complete code.

Regards,
Harish

添付ファイル:

thumbnail
8年前 に Javier Gamarra によって更新されました。

RE: Liferay Push in Android Issue

Expert 投稿: 348 参加年月日: 15/02/12 最新の投稿
You have to register a provider and service, like this:

<receiver android:name=".PushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
			<intent-filter>
				<action android:name="com.google.android.c2dm.intent.RECEIVE" />
				<category android:name="com.liferay.mobile.push" />
			</intent-filter>
		</receiver>
		<service android:name=".PushService" />


The code of the receiver/service can be very simple, like this:


public class PushReceiver extends AbstractPushReceiver {
	protected Class getPushServiceClass() {	return PushService.class;}}

public class PushService extends AbstractPushService {
	protected void processJSONNotification(final JSONObject json) throws JSONException {	BusUtil.post(json);}
}


We have to update the documentation.
thumbnail
8年前 に Harish Kumar によって更新されました。

RE: Liferay Push in Android Issue

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi Javier,

Thanks for your response. As suggested, I registered the provider and service. Also created the PushService and PushReceiver class but still I am not getting any notification on app. Could you suggest what I am missing here ?

Please find attached src folder and AndroidManifest.xml file.

Regards,
Harish
thumbnail
8年前 に Javier Gamarra によって更新されました。

RE: Liferay Push in Android Issue (回答)

Expert 投稿: 348 参加年月日: 15/02/12 最新の投稿
I've created a demo app with your code and my senderId/server and your code works flawlessly. The device gets registered and the test notification is received.

Can you uninstall the application and try to register from scratch? Do you want the demo application and I give you access to the server? (it's your code with another senderId/server)
thumbnail
8年前 に Harish Kumar によって更新されました。

RE: Liferay Push in Android Issue

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi Javier,

I created a new project in google developer console and configured it use in demo app. Now I am getting the push notifications as expected.

Thanks for your support.

Regards,
Harish