Closed macasfaj closed 11 months ago
@macasfaj Could you please send us the link to the docs you were using for badge integration?
Starting with the 6.4.0 release of our native iOS SDK, badges are handled by a Notification Service Extension. This means that you have to add some ObjC/Swift code to your native iOS project.
The problem is that in Titanium, you do not have direct access to the Xcode project. However, you can work around it like described here:
After you get access to the native project, you can just follow this guide to add Notification Service Extension and set up badges:
https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/ios-push-notifications/setting-up-badges
@macasfaj
I've came up with a bit easier solution to create an extension. You can find the example project in attachments.
As a prerequisite, you should have a separate ID and provisioning profile for your extension. Its bundle ID should start with your app's bundle ID, i.e. for com.pushwoosh.newdemo
App bundle ID I have com.pushwoosh.newdemo.NotificationServiceExtension
. Add push notifications and app groups capabilities to this ID.
${YOUR_BUNDLE_ID}.NotificationServiceExtension
.PW_APP_GROUPS_NAME
key with the name of your new app group <ios>
...
<extensions>
<extension projectPath="extensions/NotificationServiceExtension/com.appcelerator.sample.richpush.xcodeproj">
<target name="notificationservice">
<provisioning-profiles>
<device>d0481fc8-6d1e-489b-aa8c-8bdefc7f8b10</device>
<dist-appstore/>
<dist-adhoc/>
</provisioning-profiles>
</target>
</extension>
</extensions>
...
</ios>
Set UUIDs of your extension provisioning profiles in the ti info
:
tiapp.xml
add the PW_APP_GROUPS_NAME
key with the name of your group to <key>PW_APP_GROUPS_NAME</key>
<string>group.com.pushwoosh.newdemo_group</string>
notificationservice.entitlements
from the example project to your project's root and replace app group name with yours:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.pushwoosh.newdemo_group</string>
</array>
</dict>
</plist>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.pushwoosh.newdemo_group</string>
</array>
That's it, the badges should start incrementing correctly now. Please let me know about the results!
Thanks! I'll check! :)
Hi! We have a problem with the badge of the App. From the server, as explained in the documentation, we are sending a +1. But the badge never increases. If I receive several pushes, it always stays at 1.
Titanium CLI v6.1.1, SDK v12.2.0.GA
The push in server is like this:
But the badge is always 1 in iOS.
Could you help me, please? Thanks.