sap-tutorials / Tutorials

Tutorials on sap.com
https://developers.sap.com/tutorial-navigator.html
Creative Commons Attribution 4.0 International
720 stars 773 forks source link

Create a Card from a Web Application #4413

Closed socenmarc closed 4 years ago

socenmarc commented 4 years ago

Tutorial URL: https://developers.sap.com/tutorials/cp-mobile-cards-web-push.html

Hi @jitendrakansal, In this tutorial you are creating a new card with card template "default" and once the card is instantiated by the html app, a new card instance is added to the logged user client app.

My requirement is to build a process that creates card instances for different users. Is there any way to set a different user as receiver of the card?

I read about card template "Web Matching Cards" that allows me to set differents users (https://help.sap.com/viewer/70ac991a4f734773b1892a8d0d45eabc/Cloud/en-US/3843749de42f43fca8e334818cc0fe48.html). Maybe I should use it, but I have the feeling that "default" card templates are more appropiated to my purpose.

I'm exploring these pathways because I need that card instances were sent to client apps almost immediately after being created, and the "automatic instance generation" card template has big delays despite I configure query refresh mode to custom interval and set 1 minute as interval. I opened an incident on this (804927 / 2019).

Thanks in advance.

Kind regards, Marc

sandeep-tds commented 4 years ago

Hi @socenmarc

Thank you for bringing your query to our attention.

Your observation of using either Default cards or Web Page Matching Cards for externally pushed cards is absolutely correct.

From what I understood, I would recommend using Web Page Matching Cards. Web Page Matching Cards allow you to push cards with user context.

We are working on a new tutorial for creating a Web Page Matching Cards. In the meantime, you can refer to this openSAP course to create a Web Page Matching Card.

Warm Regards Sandeep T D S

socenmarc commented 4 years ago

Hi @sandeep-tds,

Thank you so much for your answer. Now I've been able to succesfully create a new Web Page Matching Card and I create new card instances from a ui5 app.

The problem I have now is that I don't get push notifications in my client app for this new card and the "Enable push notifications for this card template" is set. In summary: I can create instances, I immediately receive de card, but I don't receive push notifications. However, I receive push notifications immediately with default cards.

I did some tests and saw that web page matching cards send BACKGROUND notifications to the client app while default cards send ALERT notifications, and this is the reason because I don't receive push notifications.

Web page card notification from log:

SimpleApnsPushNotification{token='abcdefgh', payload='{"contentAvailable":true,"aps":{"content-available":1},"reason":"NEW","mobileservices.notificationId":"cac27098-bbb1-40d1-a5d0-fd4fa59e7672","data":"{\"reason\":\"NEW\",\"card.instance.id\":\"55175562-a40b-40bf-adde-f90a85faa0c1\",\"contentAvailable\":true}","card.instance.id":"55175562-a40b-40bf-adde-f90a85faa0c1"}', invalidationTime=null, priority=CONSERVE_POWER, pushType=BACKGROUND, topic='com.sap.content2go.release', collapseId='null', apnsId=null} was successfully sent.>

Default card notification from log:

SimpleApnsPushNotification{token='abcdefgh', payload='{"contentAvailable":true,"aps":{"content-available":1,"alert":{"loc-args":[""],"loc-key":"APNS.newCardAdded"},"sound":"default"},"reason":"NEW","sound":"default","mobileservices.notificationId":"6934ec9b-5b8e-4b03-9967-9a3c3feec650","data":"{\"reason\":\"NEW\",\"card.type.id\":\"aea5cc19-d2c4-4831-89d0-cddc3ee92de8\",\"sound\":\"default\",\"card.instance.id\":\"520c5afd-eee1-4d8f-872d-62818ddb36a9\",\"contentAvailable\":true}","card.type.id":"aea5cc19-d2c4-4831-89d0-cddc3ee92de8","card.instance.id":"520c5afd-eee1-4d8f-872d-62818ddb36a9"}', invalidationTime=null, priority=IMMEDIATE, pushType=ALERT, topic='com.sap.content2go.release', collapseId='null', apnsId=null} was successfully sent.

I understand that the difference in behavior is due to the purpose of each type of card, but is there any way to receive alert push notifications in web page matching cards?

Thanks in advance!

Best regards, Marc

MichaelCzcz commented 4 years ago

@socenmarc Thank you for your feedback. The issue seems to be resolved, so I am closing the issue.

If you still have questions, feel free to reopen the issue.

socenmarc commented 4 years ago

Hi,

Thanks @MichaelCzcz, it is not completely resolved.

@sandeep-tds could you please help me with the pending question from my previous comment? "I understand that the difference in behavior is due to the purpose of each type of card, but is there any way to receive alert push notifications in web page matching cards??"

Thanks in advance!

sandeep-tds commented 4 years ago

Hi,

Thanks @MichaelCzcz, it is not completely resolved.

@sandeep-tds could you please help me with the pending question from my previous comment? "I understand that the difference in behavior is due to the purpose of each type of card, but is there any way to receive alert push notifications in web page matching cards??"

Thanks in advance!

Hi @socenmarc,

The development team is looking into the behavior. Due to the complexity of the topic, it's taking longer than expected. However, I will be sure to give you an update as soon as we arrive at a conclusion.

Thank you so much for your patience.