Android additional platforms
By Technical Support
#20 Integration

To integrate BulkPush into your Appcelerator Titanium Android application you need to do simple following steps:
Download the Android Push Notifications Module and put it in your Modules folder: https://github.com/BulkPush/BulkPush-sd ... oid-Module
Don’t forget to enable this module in tiapp.xml as per Appcelerator guide.

Usage

Code: Select allvar pushnotifications = require('com.arellomobile.bulkpush');
Ti.API.info("module is => " + pushnotifications);
     
pushnotifications.pushNotificationsRegister("GOOGLE_PROJECT_ID",   
 "BULKPUSH_APP_ID", {
//NOTE: all the functions fire on the background thread,
//do not use any UI or  Alerts here
success:function(e)
{
   Ti.API.info('JS registration success event: ' + e.registrationId);
},
error:function(e)
{
   Ti.API.error("Error during registration: "+e.error);
},
callback:function(e)
 // called when a push notification is received
{
   Ti.API.info('JS message event: ' + JSON.stringify(e.data));
}
});


Geolocation

If you would like to use Geo Push Notifications add the following service to your manifest file:

Code: Select all<!-- Service for sending location updates-->
<service android:name="com.arellomobile.android.bulkpush.GeoLocationService">
</service>


Android Push Notifications Module API:

Code: Select all//Registers for android push notifications and provides
//push notification handler function (callback)
 
 
  pushnotifications.pushNotificationsRegister("GOOGLE_PROJECT_ID",
  "BULKPUSH_APP_ID", {success, error, callback});
 
   //Unregisters from push notifications
  pushnotifications.unregister();
 
  //Start tracking GeoPushes
  pushnotifications.startTrackingGeoPushes();
 
  //Stop tracking GeoPushes
  pushnotifications.stopTrackingGeoPushes();
 
  //Sets tags for the device
  pushnotifications.setTags({tagName1:tagValue1, tagName2:tagValue2});