This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin name="BackgroundServicePlugin" value="com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /////////////////// | |
(function(){ | |
// /////////////////// | |
// get local ref to global PhoneGap/Cordova/cordova object for exec function | |
var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks | |
cordovaRef.addConstructor(function() { | |
cordovaRef.addPlugin("twitterService", new BackgroundService('com.red_folder.sample.TwitterService')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="backgroundService.js"></script> | |
<script type="text/javascript" src="twitterService.js"></script> | |
<script type="text/javascript" > | |
document.addEventListener('deviceready', function() { | |
getStatus(); | |
}, true); | |
function getStatus() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<receiver android:name="com.red_folder.phonegap.plugin.backgroundservice.BootReceiver"> | |
<intent-filter> | |
<action android:name="android.intent.action.BOOT_COMPLETED"> | |
</action> | |
</intent-filter> | |
</receiver> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function enableTimer(data) { | |
if (data.TimerEnabled) | |
registerForBootStart(data); | |
else | |
window.plugins.twitterService.enableTimer( 60000, | |
function(r){ registerForBootStart(r) }, | |
function(e){ alert('An error has occurred in enableTimer') }); | |
} | |
function registerForBootStart(data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Twitter Example</title> | |
<script type="text/javascript" charset="utf-8" src="cordova-1.8.1.js"></script> | |
</head> | |
<body> | |
<h1>Twitter Example</h1> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" charset="utf-8" src="jquery-1.8.1.min.js"></script> | |
<script type="text/javascript" charset="utf-8" src="handlebars-1.0.0.beta.6.js" ></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(getTweets); | |
function getTweets() { | |
var url = "http://search.twitter.com/search.json?q=phonegap&rpp=3&page1"; | |
$.getJSON(url, function(data) { | |
var tweets = $.map(data.results, function (tweet) { | |
return { | |
author: tweet.from_user, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class='tweets'> | |
<script id='tweets-template' type='test/x-handbars-template'> | |
{{#each this}} | |
<li> | |
<img src="{{thumbnail}}" alt="{{author}}"/> | |
<p><a href="{{url}}">{{tweet}}</a></p> | |
</li> | |
{{/each}} | |
</script> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<access origin="http://search.twitter.com" /> |