It's possible to change push notification message before display on device from iOS side?

前端 未结 3 803
春和景丽
春和景丽 2020-11-29 09:45

Display my push notification message is \"Message from: +919687335565\"

attached screenshot :

I just want to fetch the name of this +919687335565 co

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 10:16

    This is possible, except:

    want to fetch name of this +91********* contact number from Address book

    because Address Book is not accessible when app is in background!
    You have to write separate logic in app itself to replace mobile no by appropriate name.

    How other than this is possible:

    Before iOS 10 and iOS 8+:
    Use PushKit to send silent push notifications, app will be woken up by iOS, change the mobile no by name, show local notification.

    iOS 10+:
    Use Notification Service Extension to alter notification content before it'll shown to user.
    Look at this official documentation

    Using this service extension, iOS gives you a way to first receive notification directly to app, modify content and then deliver to user.
    Here you can change mobile no by name.

提交回复
热议问题