Fórum

Liferay Push in Android Issue

thumbnail
Harish Kumar, modificado 8 Anos atrás.

Liferay Push in Android Issue

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
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
Javier Gamarra, modificado 8 Anos atrás.

RE: Liferay Push in Android Issue

Expert Postagens: 348 Data de Entrada: 12/02/15 Postagens Recentes
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
Harish Kumar, modificado 8 Anos atrás.

RE: Liferay Push in Android Issue

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
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
Javier Gamarra, modificado 8 Anos atrás.

RE: Liferay Push in Android Issue (Resposta)

Expert Postagens: 348 Data de Entrada: 12/02/15 Postagens Recentes
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
Harish Kumar, modificado 8 Anos atrás.

RE: Liferay Push in Android Issue

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
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