xtify.com and B4A

dealsmonkey

Active Member
Licensed User
Longtime User
Hi everyone,

I am in need of a push service for an app and have looked at xtify.com. A couple of questions,

1. I assume a library could be written for this as it is a standard .jar, before I get my "hands dirty" trying to write a wrapper !!
2. Anyone have any better alternatives ? I have looked at the googlecloud option, but see it is still in limited registration.

Thanks in advance

Neil
 

bluedude

Well-Known Member
Licensed User
Longtime User
Awesome, are you able to pull this off in a short time? Worked with Xtify before and love their stuff.

Have you also thought about something like Pusher?
 
Upvote 0

dealsmonkey

Active Member
Licensed User
Longtime User
mmm,

I'm struggling to get my head around writing a wrapper :-(

Perhaps someone with a lot more knowledge could lend a hand pleeeeeease !!

Neil
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Yeah, i''m not a java developer either :)

Wondering if somebody would do it with a little funding? Are there any commercial B4A developers out there?
 
Upvote 0

XverhelstX

Well-Known Member
Licensed User
Longtime User
I have managed to work around step 4. but I don't know how to continue with the Activity Layout. Could Agraham or Erel help at this?

Xtify Developer: How to Integrate Android Push



XverhelstX


Step 4. Edit the Main Activity Java File
Add the following code to the onCreate() method. This code starts and/or ensures that the Xtify SDK is running:
B4X:
Context context = this;
persistentLocationManager = new PersistentLocationManager(context);
Thread xtifyThread = new Thread(new Runnable() {
    @Override
    public void run() {
        persistentLocationManager.setNotificationIcon(R.drawable.notification);
        persistentLocationManager.setNotificationDetailsIcon(R.drawable.icon);
        boolean trackLocation = persistentLocationManager.isTrackingLocation();
        boolean deliverNotifications = persistentLocationManager.isDeliveringNotifications();
        if (trackLocation || deliverNotifications) {
            persistentLocationManager.startService();
        }
    }
});
xtifyThread.start(); // to avoid Android's application-not-responding dialog box, 
do non-essential work in another thread
This code also defines the notification icon and the logo that appear on the notification details screen, though that is not mandatory. The image specifications are described in the javadoc documentation.


The main Activity also contains a menu that allows the user to modify the SDK settings. This screen is displayed from the menu item using:

B4X:
persistentLocationManager.showSettingsActivity(context, false);


Step 5. Include Jar file
The 'XtifyAndroidSDK.jar' file is placed in the 'jar/' directory of your project and added to the classpath. In Eclipse, this can be accomplished by clicking Project Properties > Java Build path > Libraries > Add JARs.



Step 6: Emulator Configuration

When using the emulator, the SDK tries to access the device location. The emulator will show a 'Force close' dialog box unless you enable cell tower-based locations by checking the 'Use wireless networks' checkbox in Settings > Security & location.



Step 7: Displaying Custom Activity without Broadcast Receiver
If you do not use the broadcast receiver, then you cannot use the data associated with the notification, such as Notification Title and Notification Details. You will be able only to display your Custom Activity. If you need the notification data, then use a broadcast receiver. See Step 9 for instructions.

a. To display a custom activity when the mobile user clicks on a notification, add the code below to the AndroidManifest.xml file and remember to change the activity name to your custom activity name.

B4X:
  <activity android:name=".CustomDataActivity" android:label="Custom Data"android:screenOrientation="portrait">
 
            <intent-filter>
 
                <action android:name="com.acmelabs.DISPLAY_CUSTOM_DATA" />
 
                <category android:name="android.intent.category.DEFAULT" />
                        <data android:scheme="notif" />
 
            </intent-filter>
 
 </activity>


b. The next step is to make the action intent in the website or the web service as your custom intent name. For example:

B4X:
Action Intent: com.acmelabs.DISPLAY_CUSTOM_DATA

c. Un-check the “Show Notifications Screen” button on the Xtify Console interface, at the Action Type/Advanced tab.

It would be great if we had spoilers :D
 
Last edited:
Upvote 0

dealsmonkey

Active Member
Licensed User
Longtime User
XverhelstX

Thanks for having a look as well.

I have been looking at wrapping the SDK using the AbsObjectWrapper, but not sure if this is the right way to go, I admit my java coding is not very great !!

Looking at this SDK, it offers some great possibilities so worth pursuing !

Neil
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Great stuff, I will let Josh of Xtify know someone is working on this.

Pretty awesome if it will work.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I have managed to work around step 4. but I don't know how to continue with the Activity Layout. Could Agraham or Erel help at this?
I'm afraid that it is not clear from this how far you have got and what you need help on. Can you be more explicit?
 
Upvote 0

XverhelstX

Well-Known Member
Licensed User
Longtime User
I have managed to do almost everything except step 5 where you have to implement the Jar file.
Where do you have to put this? Do you have to make a library for this etc...
Does this work like AdMob? Also with that kind of wrapper or smth.
It would be great if someone could create a lib for this as I don't know what to do with it.
So basically I jsut added step 4 to my Main activity in Eclipse under the Oncreate event

XverhelstX
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
You have to compile your library with the jar referenced so that you can reference persistentLocationManager. You then need to include that jar in your apk like the AdMob jar. Copy and rename the AdMob xml file to match the name of the Xtify jar and put it and the jar in your additional libraries folder and select it in the Libs tab. This will make Basic4android include the jar in your apk.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Is this something Xtify could help with?

BTW, could the library be used in a service? It is very useful when it is in a service of course.
 
Upvote 0

milehi

Member
Licensed User
Longtime User
I am interested in "push" applications to Android devices as well - but don't see the point of using xtify. You can roll your own push socket server on just about any platform using standard sockets, and it's relatively easy to implement a background socket service in B4A to manage a connection reliably to handle notications on the portable device.

If xtify was a standard way of doing push to Android devices, then it would make sense to wrapper it in B4A, but it's not. xtify looks like another startup out there which has a proprietary pricing model and relies on customers using their web servers to deliver notifications. In my opinion, not something you would want to be locked into down the road if you are developing a lot of apps going forward. Just IMO, good luck.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Milehi,

Sure you can, but the question is if B4A developers really want, or are able, to run their own scalable socket server. It would basically mean that everyone would re-invent the wheel again. Unfortunately a lot of developers do this over and over again.

Yes, there are many other possibilities.

So, do you have one to share?
 
Upvote 0

dealsmonkey

Active Member
Licensed User
Longtime User
Hi all,

Now I've got to grips with writing a library, I have managed to get Xtify SDK working with B4A.

So far it is in it's simplest form, i.e connects and gets a message using their premade activities.

I will continue to work on this and let you know.

ps. I notice that the Google Cloud 2 Device is now available to all :)
 
Upvote 0
Top