Skip to content

Instantly share code, notes, and snippets.

View Red-Folder's full-sized avatar

Mark Taylor Red-Folder

View GitHub Profile
@Red-Folder
Red-Folder / index.html
Created September 24, 2012 20:59
Phonegap Service Tutorial - Part1 - Index.html - css
<style type="text/css">
ul
{
list-style: none;
}
li
{
padding-bottom: 1em;
}
@Red-Folder
Red-Folder / Plugins.xml
Created September 24, 2012 21:07
Phonegap Android Background Service Plugin - Getting started - Plugins.xml
<plugin name="BackgroundServicePlugin" value="com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin"/>
@Red-Folder
Red-Folder / AndroidManifest.xml
Created September 24, 2012 21:08
Phonegap Android Background Service Plugin - Getting started - AndroidMainfest.xml - Permission
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
@Red-Folder
Red-Folder / AndroidManifest.xml
Created September 24, 2012 21:09
Phonegap Android Background Service Plugin - Getting started - AndroidMainfest.xml - Receiver
<receiver android:name="com.red_folder.phonegap.plugin.backgroundservice.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED">
</action>
</intent-filter>
</receiver>
@Red-Folder
Red-Folder / AndroidManifest.xml
Created September 24, 2012 21:10
Phonegap Android Background Service Plugin - Getting started - AndroidMainfest.xml - Service
<service android:name="com.yournamespace.yourappname.MyService">
<intent-filter>
<action android:name="com.yournamespace.yourappname.MyService"/>
</intent-filter>
</service>
@Red-Folder
Red-Folder / twitterService.js
Created October 1, 2012 19:12
Phonegap Service Tutorial - Part2 - twitterService.js - Cordova 2.x.x
cordova.define( 'cordova/plugin/twitterService', function(require, exports, module) {
CreateBackgroundService('com.red_folder.sample.TwitterService', require, exports, module);
});
@Red-Folder
Red-Folder / index.html
Created October 1, 2012 19:18
Phonegap Service Tutorial - Part2 - Index.html - Cordova 2.x.x
<script type="text/javascript" src="backgroundService-2.0.0.js"></script>
<script type="text/javascript" src="twitterService.js"></script>
<script type="text/javascript" >
var twitterService = cordova.require('cordova/plugin/twitterService');
document.addEventListener('deviceready', function() {
getStatus();
}, true);
@Red-Folder
Red-Folder / index.html
Created October 1, 2012 19:21
Phonegap Service Tutorial - Part2 - Index.html - enableTimer snippet - Cordova 2.x.x
function enableTimer(data) {
if (data.TimerEnabled)
registerForBootStart(data);
else
twitterService.enableTimer( 60000,
function(r){ registerForBootStart(r) },
function(e){ alert('An error has occurred in enableTimer') });
}
function registerForBootStart(data) {
@Red-Folder
Red-Folder / gist:6205767
Created August 11, 2013 17:04
Powershell script to amend Android Project .classpath to point to desired library.
$classpathfile = ".classpath"
$cordovaversion = (get-item env:"CORDOVAVERSION").Value
$librarypath = "libs/cordova-" + $cordovaversion + ".jar"
Write-Host("Cordova Version: {0}" -f $cordovaversion)
Write-Host("Library Path: {0}" -f $librarypath)
$doc = [xml](Get-Content -Path $classpathfile)
@Red-Folder
Red-Folder / gist:6205783
Created August 11, 2013 17:07
Windows Batch command to rename source files
copy "%WORKSPACE%\src\com\red_folder\phonegap\plugin\backgroundservice\BackgroundServicePlugin.v%PLUGINVERSION%.txt" "%WORKSPACE%\src\com\red_folder\phonegap\plugin\backgroundservice\BackgroundServicePlugin.java"