{"id":13749273,"url":"https://github.com/HazemKhaled/TiPushNotification","last_synced_at":"2025-05-09T12:32:13.124Z","repository":{"id":141823143,"uuid":"43396725","full_name":"HazemKhaled/TiPushNotification","owner":"HazemKhaled","description":"CommonJS module to handle push notifications for both iOS and Android into Appcelerator Titanium apps","archived":false,"fork":false,"pushed_at":"2016-09-18T15:49:12.000Z","size":29,"stargazers_count":41,"open_issues_count":3,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-15T18:34:45.880Z","etag":null,"topics":["appcelerator","gcm","titanium"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HazemKhaled.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-09-29T21:54:23.000Z","updated_at":"2024-01-02T12:53:08.000Z","dependencies_parsed_at":"2024-01-17T13:12:19.180Z","dependency_job_id":null,"html_url":"https://github.com/HazemKhaled/TiPushNotification","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazemKhaled%2FTiPushNotification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazemKhaled%2FTiPushNotification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazemKhaled%2FTiPushNotification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazemKhaled%2FTiPushNotification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HazemKhaled","download_url":"https://codeload.github.com/HazemKhaled/TiPushNotification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224863108,"owners_count":17382279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appcelerator","gcm","titanium"],"created_at":"2024-08-03T07:00:58.265Z","updated_at":"2024-11-16T00:30:21.101Z","avatar_url":"https://github.com/HazemKhaled.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# TiPushNotification\nYes you can use it with your self-hosted server or any other cloud services like Parse.com or Appcelerator cloud.\n\n## Get it [![gitTio](http://gitt.io/badge.svg)](http://gitt.io/component/ti-push-notification)\nDownload the latest distribution [ZIP-file](https://github.com/HazemKhaled/TiPushNotification/releases) with latest [Android GCM module](https://github.com/morinel/gcmpush) and consult the [Titanium Documentation](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_a_Module) on how install it, or simply use the [gitTio CLI](http://gitt.io/cli):\n\n`$ gittio install ti-push-notification`\n\n## How to\nTitanium has APIs for iOS push notifications, but unfortunately you need module to for Android.\n1. Install this CommonJS module\n\n  _Note: [Android GCM module](https://github.com/morinel/gcmpush) will be installed automaticly_\n\n  `$ gittio install ti-push-notification`\n\n2. Add this code into your app.js or alloy.js\n\n```javascript\nif (Ti.Platform.name === 'android') {\n  // set android-only options\n  var pnOptions = {\n    senderId: 'XXXXXXXX', // It's the same as your project id\n    notificationSettings: {\n      sound: 'mysound.mp3', // Place soudn file in platform/android/res/raw/mysound.mp3\n      smallIcon: 'appicon.png', // Place icon in platform/android/res/drawable/notification_icon.png\n      largeIcon: 'appicon.png', // Same\n      vibrate: true, // Whether the phone should vibrate\n      insistent: true, // Whether the notification should be insistent\n      group: 'News', // Name of group to group similar notifications together\n      localOnly: false, // Whether this notification should be bridged to other devices\n      priority: 2 // Notification priority, from -2 to 2\n    }\n  };\n\n} else if (Ti.Platform.name === 'iPhone OS') { // set ios-only options.\n  // Sets interactive notifications as well if iOS8 and above. Interactive notifications is optional.\n  if (parseInt(Ti.Platform.version.split(\".\")[0], 10) \u003e= 8) {\n    var thumbUpAction = Ti.App.iOS.createUserNotificationAction({\n      identifier: \"THUMBUP_IDENTIFIER\",\n      title: \"Agree\",\n      activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_BACKGROUND,\n      destructive: false,\n      authenticationRequired: false\n    });\n\n    var thumbDownAction = Ti.App.iOS.createUserNotificationAction({\n      identifier: \"THUMBDOWN_IDENTIFIER\",\n      title: \"Disagree\",\n      activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_BACKGROUND,\n      destructive: false,\n      authenticationRequired: false\n    });\n\n    var thumbUpDownCategory = Ti.App.iOS.createUserNotificationCategory({\n      identifier: \"THUMBUPDOWN_CATEGORY\",\n      // The following actions will be displayed for an alert dialog\n      actionsForDefaultContext: [thumbUpAction, thumbDownAction],\n      // The following actions will be displayed for all other notifications\n      actionsForMinimalContext: [thumbUpAction, thumbDownAction]\n    });\n\n    var pnOptions = {\n      types: [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND],\n      categories: [thumbUpDownCategory]\n    };\n  } else { //No support for interactive notifications, omit categories\n    var pnOptions = {\n      types: [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND]\n    };\n  }\n}\n\n// set cross-platform event\nvar onReceive = function(event) {\n  // Your code here\n};\n\n// Create instance with base url\nvar tiPush = require('ti-push-notification').init({\n  backendUrl: \"http://domain.tld/register.php\"\n});\n\n// register this device\ntiPush.registerDevice({\n  pnOptions: pnOptions,\n  onReceive: onReceive,\n  extraOptions: {\n    something: \"a\",\n    key2: true,\n    user_id: 1234,\n    whatever: \"youwant\"\n  }\n});\n```\n\n### Contributions\nYour issues and pull requests are most welcome, also you can pick a task from [TODOs](#todos).\n\n### TODOs\n1. Server-side snippets for PHP and NodeJS\n2. Parse.com example\n3. Wordpress self-hosted example\n4. APN Server API setup tutorial\n5. GCM Server API setup tutorial\n6. Add option to depend on [CaffeinaLab GCM](https://github.com/CaffeinaLab/GCM) or [Jeroen GCM](https://github.com/morinel/gcmpush) module.\n\n### Changelog\n**v0.1.3**\u003cbr\u003eAdd `extraOptions` parameter to be uploaded to backend too\n\n**v0.1.2**\u003cbr\u003eImplementation changed, no need for factory, use init function directly Now module Titaniumified\n\n**v0.1.0**\u003cbr\u003eInitialed base of [ACS Push Notifications](https://github.com/ricardoalcocer/acspushmod)\n\n### Credits\nThis module is based on [ACS Push Notifications](https://github.com/ricardoalcocer/acspushmod) CommonJS module by my Ricardo Alcocer.\n\n## License\nOriginal code written in my full-time @ [Rize Inno](https://github.com/RizeInno), code open source by Rize Innovations, FZO under MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHazemKhaled%2FTiPushNotification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHazemKhaled%2FTiPushNotification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHazemKhaled%2FTiPushNotification/lists"}