Cordova Motion Reminder: Cordova plugin to notify device motion events

Recommend this page to a friend!
  Info   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 59 All time: 487 This week: 1Up
Version License JavaScript version Categories
cordova-reminder 0.9.8BSD License3Geography, Events, PhoneGap
Description Author

This package is plugin for Apache Cordova or PhoneGap to notify device motion events.

It can notify when the device traversed a certain distance or reached a certain destination.

The object interface takes callback functions that are invoked to notify the motion events or when an error occurs.

Currently the plugin comes with support for Android and Windows Phone.

Innovation Award
JavaScript Programming Innovation award nominee
June 2015
Number 6
Determining if the user reached a certain destination with certain coordinates or traversed a certain distance, requires that your application keeps checking the user location coordinates and determine if they are within an approximate range of the traversed distance or destination location.

This package simplifies this process by providing a plugin for Cordova or PhoneGap to send notifications when the device reached a destination or traversed a certain distance.

Manuel Lemos
Picture of Franz Josef Brünner
  Performance   Level  
Name: Franz Josef Brünner <contact>
Classes: 6 packages by
Country: Austria Austria
Age: 37
All time rank: 271 in Austria Austria
Week rank: 6 Up1 in Austria Austria Equal
Innovation award
Innovation award
Nominee: 5x

Winner: 4x

Details

This Cordova-Plugin enables users to get notified by Reminder-Notifications based on destination coordinates, distance, movement and time.

<h3>Start a Reminder-Notification</h3>

<blockquote>

<p><b>Reminder.start( out success:Function, out error:Function, in options:Object ) : undefined</b></p>

<p>@param <b><i>success</i></b> must be a Function to be called when all went right and/or a new Remind-Notification is set.</p> <p>@param <b><i>error</i></b> must be a Function to be called when there has been an error and/or a Remind-Notification could not be set.</p> <p>

@param <b><i>options</i></b> must be an Object to be given to adjust some Preferences:
<ul>
  <li><b><i>mode</i></b> must be a String to determine whether to show a Reminder-Notification on "aim", "track" or "status" mode, </br><b>default: "aim"</b>
         <ul>

	<li>
	  "aim": show Reminder-Notifcation when an user reaches a certain aim/destination.</br>
              required properties:
	  <ul>
	     <li>
                    <b><i>distanceTolerance</i></b> is considered to be the radius of the aim/destination in meter.
	     </li>
                 <li>
                    <b><i>aimCoord</i></b> must be an Object that holds lat/long properties to determine the location of aim/destination.
	     </li>
	  </ul>
	</li>

	<li>
              "track": show Reminder-Notifcation when an user reaches a certain distance.</br>
              required properties:
	  <ul>
	     <li>
                    <b><i>distance</i></b> is considered how far an user has gone in meter.
	     </li>
	  </ul>
	</li>

	<li>
              "status": show Reminder-Notifcation when an user comes to a stop so fell below or exceeded a certain gone distance per time. Either way it is tested whether movement status has changed(go/stop | stop/go) for a Reminder-Notification is shown.</br>
              required properties:
	  <ul>
	     <li>
                    <b><i>distance</i></b> is considered to be the radius an user has to exceed or fall below to be notified by Reminder-Notifications. 
	     </li>
                 <li>
                    <b><i>interval</i></b> is considered how often a geolocation measure is executed.
	     </li>
	  </ul>
	</li>

     </ul>
     </li>
     <li><b><i>distanceTolerance</i></b> must be a Number to omit possibly fluctuations, by default all distance-alterations that fall below 10 meter are taken into consideration with all modes. </br><b>default: 10</b></li>
  <li><b><i>aimCoord</i></b> must be an Object that holds latitude and longitude to determine aim/destination coordinates. </br><b>default: latitude 0, longitude 0</b></li>
      <li><b><i>title</i></b> must be a String to be shown as title within Reminder-Notification, </br><b>default: "Reminder-Notification"</b></li>
  <li><b><i>content</i></b> must be a String to be shown as content-text within a Reminder-Notification. Within content there can be a #ML-Notation(linear-distance) that is replaced by the actual gone meters and #MR(radius-distance) for instance "You went #ML meters! within a radius of #MR" is shown within a Reminder-Notification where #ML/#MR are Numbers representing linear/radius-distance.</br> <b>default: "Reminder-Content"</b></li>
  <li><b><i>interval</i></b> must be a Number in Milliseconds to be gone to show a Reminder-Notification, </br><b>default: 60000(1 minute)</b></li>
  <li><b><i>distance</i></b> must be a Number in Meter to be reached to show a Reminder-Notification, </br><b>default: 100</b></li>
  <li><b><i>aggressive</i></b> must be a Boolean to determine whether geolocation measurement of modes "aim" and "track" should be executed aggressively or not. When "status" mode is used this option is set to <b>false</b>, </br><b>default: true</b></li>
  <li><b><i>whistle</i></b> must be a Boolean to enable/disable Whistle-Sound. </br><b>default: true</b></li>
  <li><b><i>closeApp</i></b> must be a Boolean to-close/not-to-close App. This option is not supported by WP8. </br><b>default: true</b></li>
  <li><b><i>stopDate</i></b> must be a String to indicate Reminder should run forever or being stopped next Day, ("forever" | "tomorrow") </br><b>default: "forever"</b></li>
</ul>

</p>

<p>@return undefined</p>


</blockquote>

<h4>A Reminder-Notification example of all modes:</h4>

<p><b><i>"aim"</i></b>: When a user has reached a certain aim/destination whithin 30 meters and 1 minute has passed(default) since it has been started a Reminder-Notification is shown. This measurement is done in a lazy way(aggressive off).</p>


 Reminder.start(function(){
    console.log("Reminder success")
 },
 function(e){
    console.log("Reminder error",e);
 },{
    title: "Reminder",
    content: "You have reached your destination!",
    mode: "aim",
    // required properties
    aimCoord:{
        lat:40.97989806,
        long:-95.2734375
    },
    distanceTolerance: 30,
    aggressive: false
 });

<p><b><i>"track"</i></b>: When an user has gone 150 meter and 10 seconds have passed a Reminder-Notification is shown and do not take 10 meter movement fluctuation into consideration. This measurement is done in an aggressive way so current locations are queried all the time(aggressive on).</p>


 Reminder.start(function(){
    console.log("Reminder success")
 },
 function(e){
    console.log("Reminder error",e);
 },{
    title: "Reminder",
    content: "You have gone #ML within a radius of #MR in meter!",
    interval: 10000,
    mode: "track",
    // required properties
    distance: 150,
    distanceTolerance : 10
 });

<p><b><i>"status"</i></b>: All 45 seconds it is tested whether an user exceeded or fell below 100 meter distance.This measurement is done in a lazy way(aggressive off)</p>


 Reminder.start(function(){
    console.log("Reminder success")
 },
 function(e){
    console.log("Reminder error",e);
 },{
    title: "Reminder",
    content: "You have come to a stop while you have gone #MR in meter!",
    mode: "status",
    // required properties
    interval: 45000,
    distance: 100
 });

<h3>Clear/Cancel a Remind-Notification</h3>

<blockquote>

<p><b>Reminder.clear( out success:Function, out error:Function ) : undefined</b></p>

<p>@param <b><i>success</i></b> must be a Function to be called when all went right and/or a new Remind-Notification is cleared.</p> <p>@param <b><i>error</i></b> must be a Function to be called when there has been an error and/or a Remind-Notification could not be cleared.</p>

<p>@return undefined</p>


</blockquote>


 Reminder.clear(
    function(){
       console.log("Reminder cleared")
    },
    function(e){
       console.log("Reminder cleared error",e);
    }
 );

<h3>Check for Reminder is running</h3>

<blockquote>

<p><b>Reminder.isRunning( out success:Function, out error:Function ) : undefined</b></p>

<p>@param <b><i>success</i></b> must be a Function to be called when all went right and a result is returned as <i>Object</i>-parameter to check whether Reminder is running.</p> <p>@param <b><i>error</i></b> must be a Function to be called when there has been an error.</p>

<p>@return undefined</p>


</blockquote>


 Reminder.isRunning(function(result){
      console.log("Reminder isRunning",result.isRunning);
 },
 function(e){
      console.log("Reminder isRunning error",e);
 });

<h3>Make a request to GPS-Provider</h3>

<blockquote>

<p><b>Reminder.requestProvider( out success:Function, out error:Function ) : undefined</b></p>

<p>@param <b><i>success</i></b> must be a Function to be called when all went right and a result is returned as <i>Object</i>-parameters containing provider information (see at example)</p> <p>@param <b><i>error</i></b> must be a Function to be called when there has been an error.</p>

<p>@return undefined</p>


</blockquote>


 Reminder.requestProvider(function(info){
      console.log("Reminder requestProvider: ",info);	
      console.log("Reminder accurancy: ",info.coords.accurancy);	
      console.log("Reminder latitude: ",info.coords.latitude);	
      console.log("Reminder longitude: ",info.coords.longitude);	
      console.log("Reminder heading: ",info.coords.heading);
      console.log("Reminder altitude: ",info.coords.altitude);
      console.log("Reminder speed: ",info.coords.speed);	
      console.log("Reminder gps_fix: ",info.coords.gps_fix);
      console.log("Reminder provider_enabled: ",info.coords.provider_enabled);	
      console.log("Reminder out_of_service: ",info.coords.out_of_service);

      console.log("Reminder timestamp: ",info.timestamp);	
 },
 function(e){
      console.log("Reminder requestProvider",e);
 });

<h3>Supported Platforms:</h3>

<ul> <li>Android(Jelly Bean, Version: >= 4.1, API: >= 16)</li> <li>Windows Phone 8 (WP8)</li> </ul>

<h3>License:</h3> GNU: Basically this software can be used and modified freely and without any restrictions but replace Icon, Images and other visual Resources in this Project when using it publicly.

  Files folder image Files  
File Role Description
Files folder imagesrc (2 directories)
Files folder imagewww (1 file)
Plain text file plugin.xml Data plugin meta info
Plain text file README.md Data doc

  Files folder image Files  /  src  
File Role Description
Files folder imageandroid (4 files, 1 directory)
Files folder imagewp8 (2 files)

  Files folder image Files  /  src  /  android  
File Role Description
Files folder imageicon (4 directories)
  Plain text file NotificationInterface.java Data android native code
  Plain text file ReminderLauncher.java Data android native code
  Plain text file ReminderService.java Data android native code
  Plain text file RunningInterface.java Data android native code

  Files folder image Files  /  src  /  android  /  icon  
File Role Description
Files folder imagedrawable-hdpi (1 file)
Files folder imagedrawable-mdpi (1 file)
Files folder imagedrawable-xhdpi (1 file)
Files folder imagedrawable-xxhdpi (1 file)

  Files folder image Files  /  src  /  android  /  icon  /  drawable-hdpi  
File Role Description
  Image file ic_billclick_large.png Icon notification image

  Files folder image Files  /  src  /  android  /  icon  /  drawable-mdpi  
File Role Description
  Image file ic_billclick_large.png Icon notification image

  Files folder image Files  /  src  /  android  /  icon  /  drawable-xhdpi  
File Role Description
  Image file ic_billclick_large.png Icon notification image

  Files folder image Files  /  src  /  android  /  icon  /  drawable-xxhdpi  
File Role Description
  Image file ic_billclick_large.png Icon notification image

  Files folder image Files  /  src  /  wp8  
File Role Description
  Plain text file ExtensionMethods.cs Data win-phone 8 native code
  Plain text file Reminder.cs Data win-phone 8 native code

  Files folder image Files  /  www  
File Role Description
  Plain text file Reminder.js Class Actual Class Reminder

 Version Control Unique User Downloads Download Rankings  
 100%
Total:59
This week:0
All time:487
This week:1Up