Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
New Contributor
Posts: 9
Registered: ‎02-11-2009
My Device: Not Specified
Accepted Solution

How to simulate GPS on blackberry tablet.

How to simulate GPS on blackberry tablet.

I have seen this thread but didn't get relevant information.

 

Kindly let me know setp  by set procedure.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to simulate GPS on blackberry tablet.

That thread had lots of useful info, but apparently it's not "relevant" to you.

 

Maybe you'd better tell us what is relevant...

 

Or shall we just guess?


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 152
Registered: ‎08-25-2010
My Device: 9530, 9550, 9630
My Carrier: Verizon

Re: How to simulate GPS on blackberry tablet.

I would imagine this post would have been helpful.....for simulating the GPS of around Charlottesville, VA


jtegen wrote:

Here is the simulator for GPS features.  Works pretty well to get around the fact that the simulator does not simulate GPS and I dont have a PB (yet).  This simulator is around Charlottesville, VA.

 

package gps
{
import flash.events.Event;
import flash.events.GeolocationEvent;
import flash.events.TimerEvent;
import flash.sensors.Geolocation;
import flash.utils.Timer;

public class GpsPositionDriver
{
private var timer : Timer = new Timer( 2000 );
private var gps_service : Geolocation = null;
private var last_step : int = 0;
private var data : Array = new Array();
private var start_time : Number = 0;

//////////////////////////////////////////////////////////////////
public function GpsPositionDriver( sensor : Geolocation )
{
this.gps_service = sensor;
this.timer.addEventListener( TimerEvent.TIMER, Ping );

var now : Date = new Date();
this.start_time = now.getTime();

// data
this.data.push( { altitude : 600, heading : 45, hacc : 100, vacc : 100, latitude : 38.020654096686464, longitude : -78.53692074499511, speed : 10 } );
this.data.push( { altitude : 601, heading : 46, hacc : 100, vacc : 100, latitude : 38.02160072090434, longitude : -78.53949566564941, speed : 12 } );
this.data.push( { altitude : 601, heading : 270, hacc : 100, vacc : 100, latitude : 38.022090932211185, longitude : -78.54177017889404, speed : 13 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02234448849692, longitude : -78.54357262335205, speed : 15 } );

this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02242900706387, longitude : -78.5454179831543, speed : 2 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.022344488497076, longitude : -78.54835768423462, speed : 3 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02227687357351, longitude : -78.55168362341308, speed : 5 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02210783599131, longitude : -78.55638285360718, speed : 1.5 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02187118272113, longitude : -78.56230517111206, speed : 1 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02166833645269, longitude : -78.56691857061767, speed : 5.5 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02166833645269, longitude : -78.57022305212402, speed : 5 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.022006413255085, longitude : -78.57387085638427, speed : 5 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02283469482895, longitude : -78.57738991461181, speed : 2.5 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.02454193955506, longitude : -78.58196039877319, speed : 17 } );
this.data.push( { altitude : 601, heading : 275, hacc : 100, vacc : 100, latitude : 38.0275675527831, longitude : -78.58826895437622, speed : 8 } );
this.data.push( { altitude : 601, heading : 290, hacc : 100, vacc : 100, latitude : 38.029832455209, longitude : -78.59288235388183, speed : 7 } );
this.data.push( { altitude : 601, heading : 300, hacc : 100, vacc : 100, latitude : 38.0320803861371, longitude : -78.59751721105957, speed : 10 } );
this.data.push( { altitude : 601, heading : 25, hacc : 100, vacc : 100, latitude : 38.033009961471976, longitude : -78.59901924810791, speed : 12 } );
this.data.push( { altitude : 601, heading : 30, hacc : 100, vacc : 100, latitude : 38.034598662916025, longitude : -78.6012508460083, speed : 11 } );


}

/////////////////////////////////////////////////////////////
public function Start() : void
{
this.timer.start();
}

/////////////////////////////////////////////////////////////
public function Stop() : void
{
this.timer.stop();
}

/////////////////////////////////////////////////////////////////
private function Ping( event : Event ) : void
{
var now : Date = new Date();

var evt : GeolocationEvent = new GeolocationEvent( GeolocationEvent.UPDATE );
evt.altitude = this.data[this.last_step].altitude;
evt.heading = this.data[this.last_step].heading;
evt.latitude = this.data[this.last_step].latitude;
evt.longitude = this.data[this.last_step].longitude;
evt.horizontalAccuracy = this.data[this.last_step].hacc;
evt.verticalAccuracy = this.data[this.last_step].vacc;
evt.speed = this.data[this.last_step].speed;
evt.timestamp = now.getTime() - this.start_time; // ms from runtime initialized

this.gps_service.dispatchEvent( evt );

this.last_step++;
if( this.last_step == this.data.length )this.last_step = 0; // reset

}
}
}