Hi Everyone,
Sorry for the delay in posting, but here is my first version of a library to connect to xtify push services.
For those who do not know the service, go to Xtify: Free Push Notifications for iOS (iPhone, iPad), Android and Blackberry devices | Xtify
Firstly extract the 4 files and copy them both to your add libraries folder, then tick them both in the B4A Libs pane. They are nejoXtify.jar & nejoXtifylib.jar, nejoXtify.xml & nejoXtifylib.xml
The library has only 2 calls from within B4A :
1. initialize("EventName")
2. ShowSettings("")
Here is an example of the initilize method :
As you can see, this method is called in a service module and the _xtfymessagereceived() sub is used to listen for the message and act upon what is received, a title and a body. That is all that is needed to register the device with xtify and listen for messages :sign0060:
When you run your app, you will see the device in "Test Implementation" section of the xtify website. Just send a message and voila a toast will appear !!
The Second Method ShowSettings(""), must be run within an activity and is used to show the xtify custom preferences activity. Here is an example :
That is it for the preferences activity, the library handles storing the preference data etc..
The final part of the library is setting your manifest.xml file. Once the lines are added, make the manifest.xml read only or use the "do not overwrite the manifest" option in B4A.
The details for this are here : How to Integrate Android Push
The only important thing to remember is that if you want to use the custom notification as used in the first example here, then add these lines to the manifest.xml
This is an alternative push solution to Erel's excellent Google C2DM implementation, offering different facilities for the developer to interact with their app users. The technology uses xmpp push technology and seems fine at minimal battery use with instant push messages.
Let me know if you have any problems.
Neil
Sorry for the delay in posting, but here is my first version of a library to connect to xtify push services.
For those who do not know the service, go to Xtify: Free Push Notifications for iOS (iPhone, iPad), Android and Blackberry devices | Xtify
Firstly extract the 4 files and copy them both to your add libraries folder, then tick them both in the B4A Libs pane. They are nejoXtify.jar & nejoXtifylib.jar, nejoXtify.xml & nejoXtifylib.xml
The library has only 2 calls from within B4A :
1. initialize("EventName")
2. ShowSettings("")
Here is an example of the initilize method :
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim xtify As NejoXty
End Sub
Sub Service_Create
xtify.initialize("xtify")
End Sub
Sub xtify_xtfymessagereceived(title As String, body As String)
Log("Message : " & title & " " & body)
ToastMessageShow(Title & body,False)
End Sub
As you can see, this method is called in a service module and the _xtfymessagereceived() sub is used to listen for the message and act upon what is received, a title and a body. That is all that is needed to register the device with xtify and listen for messages :sign0060:
When you run your app, you will see the device in "Test Implementation" section of the xtify website. Just send a message and voila a toast will appear !!
The Second Method ShowSettings(""), must be run within an activity and is used to show the xtify custom preferences activity. Here is an example :
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim xty As nejoXtyShowSettings
End Sub
Sub Button1_Click
xty.ShowSettings("")
End Sub
That is it for the preferences activity, the library handles storing the preference data etc..
The final part of the library is setting your manifest.xml file. Once the lines are added, make the manifest.xml read only or use the "do not overwrite the manifest" option in B4A.
The details for this are here : How to Integrate Android Push
The only important thing to remember is that if you want to use the custom notification as used in the first example here, then add these lines to the manifest.xml
B4X:
<receiver android:name="com.nejo.android.xtify.NejoXtyreceiver">
<intent-filter android:priority="9999">
<action android:name="com.xtify.android.sdk.SHOW_NOTIFICATION" />
<!-- KEEP THE FORWARD SLASH IN FRONT OF THE APP KEY ON THE LINE BELOW -->
<data android:scheme="notif" android:host="notification.xtify.com"
android:pathPrefix="/YOUR-APP-KEY-HERE" />
</intent-filter>
</receiver>
This is an alternative push solution to Erel's excellent Google C2DM implementation, offering different facilities for the developer to interact with their app users. The technology uses xmpp push technology and seems fine at minimal battery use with instant push messages.
Let me know if you have any problems.
Neil
Attachments
Last edited: