UPDATED VERSION: Appcelerator Titanium Alloy JPUSH Push Notification Module – iOS and Android, China Push Notification- NON GCM

Hi,

As you may know Chinese Android phones do not ship with the Google Play store – thus Google Cloud Messaging does not work.

If you are creating a Android Application or a version of your APP for the Chinese market it would be best if you use a Chinese Push Service like JPUSH.

The backend is in Chinese – You can sign up at https://www.jpush.cn/ – Its very very simple – you should just be able to use Google Translate to help you figure out how to use it – Its totally free.

After alot of research and searching I found that there was not a module that would work – I did find a half written module on a Chinese Blog but it was not exactly what I needed.

So I wrote a JPUSH Module for Titanium Alloy to be able to use the Chinese JPUSH Service. As this was alot of work I am asking for a small donation to be able to download the compiled and ready to use version of my JPUSH Titanium Alloy Android Module.

**** THIS MODULE IS PROVIDED WITHOUT ANY FORM OF SUPPORT ****

CLICK HERE TO DONATE AND DOWNLOAD THE JPUSH TITANIUM ALLOY ANDROID MODULE

 

Once you donate you will receive an email with instructions on how to download the module – if you do not please let me know!

## INSTALLATION

1. Place zip in your app root and build app – titanium will automatically extract and install the app.
2. Add Module into your tiapp.xml via Studion GUI or via adding 

<module platform="android">com.yeshcp.jpush</module>

3. Add the Following Like to you tiapp.xml file to prevent Android Crashing

<property name="ti.android.bug2373.finishfalseroot" type="bool">true</property>

## SETTING YOUR APP ID

4. You Will also need to change the the YOURAPPID below to your app ID found on JPUSH

Location: modules/android/com.yeshcp.jpush/VERSION/timodule.xml

<meta-data android:name="JPUSH_APPKEY" android:value="YOUR-JPUSH-APPID-GOES-HERE"/>

## USAGE

5. Place the following code if you app.js file to catch the Push Notification and display it via a POPUP in your app

// REQUIRE JPUSH MOFULE
	var JPush = require('com.yeshcp.jpush');
		
	// ADD EVENTLISTENTER AND FUNCTION TO MODULE
	JPush.addEventListener('pushCallBack',function(evt){
         
		// Set pushNotification as evt
		var pushNotification = evt; 
		// Set pushExtras and JSON.parse into Object
		var pushNotificationExtra = JSON.parse(evt.extras);

		
		// set pushType as alertType 	
		var pushType = pushNotificationExtra.alertType || 'push type';		
		// Set Values	
		var pushTitle = pushNotification.title || 'Push Title';
		var pushMessage = pushNotification.alert || 'Push Alert';
		var pushConfirm = pushNotificationExtra.alertConfirm || 'Push Confirm';
		var pushCancel = pushNotificationExtra.alertCancel || 'Push Cancel';
		var pushURL = pushNotificationExtra.alertURL || 'Push URL';
		
		// Ti.API.info all Values
		Ti.API.info("Type:" + pushType + "Title:" + pushTitle + "Message:" + pushMessage + "pushConfirm:" + pushConfirm + "pushCancel:" + pushCancel + "pushURL:" + pushURL); 
    
    	// setTimeout of 500miliseconds and then run pushPopUp function with params
		setTimeout(function(){
			pushPopUp(pushType,pushTitle,pushMessage,pushConfirm,pushCancel,pushURL);
		},500); 
		
    });

 

// OTHER POSSIBLE FUNCTIONS
	// Set Alias and Tags
	push.setAliasAndTags('chelsea',['grade1','grade2'],function(e){
	    alert('setAliasAndTags' + JSON.stringify(e));
	});
	
	setTimeout(function(){
	    push.setAlias('',function(e){
	        alert('setAlias' + JSON.stringify(e));
	    });
	},5000);
	
	setTimeout(function(){
	    push.setTags([],function(e){
	        alert('setTags' + JSON.stringify(e));
	    });
	},10000);

If you would like the Source of the Module to add features and compile on your own let me know and I can provide it to you as well.

If you would not like to pay for the module and have a good reason like being a non-profit let me know in the comments and I can provide you with a copy for free.

Let me know if you need any help.

Module: Appcelerator Titanium Alloy JPUSH Push Notification Module – Android, China Push Notification- NON GCM
Tagged on:                                                             

Leave a Reply

Your email address will not be published. Required fields are marked *

10 thoughts on “Module: Appcelerator Titanium Alloy JPUSH Push Notification Module – Android, China Push Notification- NON GCM