Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 6    Views: 58

FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
05/27/15 01:36 AM (9 years ago)

requesting a loint loyalty card for ios and android

hi guys ive managed to get push working for both ios and android, running through my self hosting, i will post guide if anyone wants one, there 2 diff loyalty scheme plugins in the market, 1 for ios and 1 fro android, can either of the developers produce one for both, what im trying to do is allow clients just one login to there apps, so its not confusing for them, cheers sean
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
05/27/15 03:29 AM (9 years ago)
Well, you could manually 'combine' the two, given a little skill... You'd want to choose 'one' as the master. download both 'self hosted' versions, and use the parts of both to create 'one'. If you were to choose the Android version as master, you would download the self hosted version, and after downloading the iOS version, 'modify' the iOS class files for the Android Master Version. After that, change the config.txt file to reflect 'iosAndAndroid'. Also, add the HTML files from the iOS version into the 'Master' directory, as well as modify the 'config_cp.txt' file to reflect the additional HTML files. Out of 10, I'd give it between a 4-6 on the difficulty scale. You're not really writing code, but you do need to be familiar with how a plugin goes together. If you want to get 'really' fancy, you can modify the control panel properties to be the same across both platforms, although not 'everything' may work; some things might still be specific to Android and/or iOS. In that case, there isn't much more you can do other than modify the HTML file to distinctly identify as for use in Android or iOS. That would require some code massage. Hope this provides a half decent option... Cheers! -- Smug
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
05/27/15 04:23 AM (9 years ago)
>managed to get push working for both ios and android, running through my self hosting, i will post guide if anyone wants one, Yes please, and be sure to send a copy to David Book too! >can either of the developers produce one for both, An interesting requirement, let's see what the developers will do.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/27/15 04:50 AM (9 years ago)
Thanks smug, but thats bit out of my knowledge base, i was hoping one of you coders could do it and sell it on the market, as it could be quite valuable plugin and you could charge for that. cheers sea
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/27/15 04:55 AM (9 years ago)
Heres what i followed to get push to work from your own control panel on both ios and android assuming you,ve followe the other instructions on how to get pem file for control panel and gcm gives you the no for android later. this is mainly for android as i never had problem with push on ios in the BT_gcmConfig.java theres this code ----------------------------------------------------------------------------- //get GCM Project Number from AndroidManifest.xml... public static String getGCMProjectNumber(){ //get the googleAPIProjectNumber from the AndroidManifest.xml file... ApplicationInfo ai = null; String tmpGcmNumber = "129905444818"; comment out or remove everything below, except the return tmpGcmNumber; //try{ // ai = //connections_appDelegate.getApplication().getPackageManager().getApplicationInfo(connections_appDelegate.getApplication().getPackageName(), PackageManager.GET_META_DATA); // tmpGcmNumber = (String)ai.metaData.get("googleCloudMessagingProjectNumber"); // BT_debugger.showIt(CLASS_NAME + ":getGCMProjectNumber. Using Google GCM Project Number in AndroidManifest: \"" + tmpGcmNumber + "\""); // }catch(NameNotFoundException e) { // BT_debugger.showIt(CLASS_NAME + ":getGCMProjectNumber. EXCEPTION. Google GCM Project Number not found in AndroidManifest?"); // } //retuan... return tmpGcmNumber; ----------------------------------------------------------------------------- Replace the above with the below --------------------------------------------------------------------------- //get GCM Project Number from AndroidManifest.xml... public static String getGCMProjectNumber(){ //get the googleAPIProjectNumber from the AndroidManifest.xml file... String tmpGcmNumber = "use your own project no"; return tmpGcmNumber; } ----------------------------------------------------------------------------- now open BT_gcmIntentService.java replace the code with below code ---------------------------------------------------------------------------- int icon = R.drawable.icon; long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); //title of message... String title = context.getString(R.string.app_name); //messages show in the built in notification center... Intent notificationIntent = new Intent(context, BT_activity_host.class); Notification.Builder builder = new Notification.Builder(connections_appDelegate.getContext()); Notification notification = new Notification(icon, message, when); //flag so intent does not start a new activity... notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); //below line is new notification.setLatestEventInfo(context, title, message, intent); notification.flags |= Notification.FLAG_AUTO_CANCEL; //play sound for notification... notification.defaults |= Notification.DEFAULT_SOUND; //vibrate if enabled... notification.defaults |= Notification.DEFAULT_VIBRATE; //finish builder... builder.setContentIntent(intent); builder.setSmallIcon(icon); builder.setAutoCancel(false); builder.setContentTitle(title); builder.setContentText(message); notificationManager.notify(0, notification); //notify... notificationManager.notify(); } ----------------------------------------------------------------------------- go to your google development console (new One) create project and apis & auth choose cloud messaging fro android and googgle maps api. press overview and your project no is up top. next choose credentials under apis and create new server key (public api)leave the ip address part blank and press next. hopefully thats all you need to get started, ive tested it out on both live ios and android devices, no crashes and push comes through. cheers sean //get GCM Project Number from AndroidManifest.xml... public static String getGCMProjectNumber(){ //get the googleAPIProjectNumber from the AndroidManifest.xml file... String tmpGcmNumber = "use your own project no"; return tmpGcmNumber; } now open BT_gcmIntentService.java replace the only the code with below code int icon = R.drawable.icon; long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); //title of message... String title = context.getString(R.string.app_name); //messages show in the built in notification center... Intent notificationIntent = new Intent(context, BT_activity_host.class); Notification.Builder builder = new Notification.Builder(connections_appDelegate.getContext()); Notification notification = new Notification(icon, message, when); //flag so intent does not start a new activity... notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); //below line is new notification.setLatestEventInfo(context, title, message, intent); notification.flags |= Notification.FLAG_AUTO_CANCEL; //play sound for notification... notification.defaults |= Notification.DEFAULT_SOUND; //vibrate if enabled... notification.defaults |= Notification.DEFAULT_VIBRATE; //finish builder... builder.setContentIntent(intent); builder.setSmallIcon(icon); builder.setAutoCancel(false); builder.setContentTitle(title); builder.setContentText(message); notificationManager.notify(0, notification); //notify... notificationManager.notify(); } go to your google development console (new One) create project and apis & auth choose cloud messaging fro android and googgle maps api. press overview and your project no is up top. next choose credentials under apis and create new server key (public api)leave the ip address part blank and press next. hopefully thats all you need to get started, ive tested it out on both live ios and android devices, no crashes and push comes through. cheers sean
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/27/15 07:33 AM (9 years ago)
Well done Sean, there are plenty of people (me included) that failed to get push working 100% across ios and android and live. I did it in dev, but I could never get live ios to work. Alan
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/27/15 07:55 AM (9 years ago)
dont thank me dude, i just spent 2 weeks going through everybody elses,s suggestions incl yours, till i found one that worked, im quite sure its how it was supposed to work when it was designed, but other bits of code probably conflicted with it, cheers Sean
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.