Problem with android 6.0.1 GPS locator

271 views
Skip to first unread message

Francesco Mengaroni

unread,
Jan 7, 2017, 4:51:06 AM1/7/17
to DroidScript
Hi guys, i made an application that use the locator component . The locator cause a system crash and stop The mobile, i had to reboot the mobile. In the other, with android 6.0 It works ad well.

Any Suggestion ?

Sorry for my orribile English..

Steve Garman

unread,
Jan 7, 2017, 6:34:47 AM1/7/17
to DroidScript
When you say "system crash" what exactly happens?

How can you tell it is the locator causing the problem?

Are you using "GPS" or "Network" or both?

Do you get this problem if you run the sample app
"Location - Use GPS and/or network to find location" from the DroidScript samples?

Are you using custom firmware such as CyanogenMod?

Francesco Mengaroni

unread,
Jan 7, 2017, 7:22:20 AM1/7/17
to DroidScript
ok system crash i means that mobile device is blocked. You cannot make any acion and you have to detach the battery for to restart.
the locator start  is setted on GPS and Network.  i'm not installed  droidscript in it,  is my wife mobile. i maked an apk and i installed in it.
I don't know what is CyanogenMod firmware.
Claudia's mobile has android 6.0.1 
model is ASUS_Z00ED 
band base m3.6.51-ZE50000KL_20236_8916  
kernel 3.10.49-perf-gffc47ef-00061-g818133 
android@mcrd1-34 #1
wed oct 26 12:43:42 cst 2016 
number of build:
MMB29P.WW_Phone-13.10.10.44-20161026060020705_201602050034







Francesco Mengaroni

unread,
Jan 7, 2017, 7:45:49 AM1/7/17
to DroidScript
This is the code i used:

function StartLocator ()
{
loc = app.CreateLocator("GPS,Network");
loc.SetOnChange(loc_OnChange);
loc.Start();
}

function loc_OnChange(pos)
{

//alert(pos.latitude+ " "+ pos.longitude);

lat = pos.latitude;
lng = pos.longitude;

if(pos!=null) {
//app.HideProgress();
loc.Stop();
}

// GetGPSCoords(lat, lng);
}

Charles Wilt

unread,
Jan 7, 2017, 8:49:51 AM1/7/17
to DroidScript
What code calls your StartLocator function?

Francesco Mengaroni

unread,
Jan 7, 2017, 8:58:02 AM1/7/17
to DroidScript
A comunicare function
All start with a list.SetOnTouch(function_callout);
...

function esegui_funzione( title, body, type, index )
{

if (title == "Make a Picture" )
{
takeAPicture(create_picture_name(getTimestamp()));
// isPic = true;
}
if (title == "Get GPS Coords")
{
StartLocator(); // StartLocator() is the function forum ti call GPS pos.
// isGps = true;
}
if (title == "Write a Note")
{
WriteANote();
}
}

Message has been deleted

Steve Garman

unread,
Jan 8, 2017, 4:27:14 AM1/8/17
to DroidScript
There is no known general problem using the locator on 6.0.1 so we need to try to track down the specific problem.

Are you using exactly the same apk to test on the 6.0 device and the 6.0.1 phone?

Have you tried making an apk from the sample app
"Location - Use GPS and/or network to find location" from the DroidScript samples and installing it on your wife's phone?

Are we able to rule out a fault on the 6.0.1 phone? Does your wife use the GPS on her phone for anything else?

Francesco Mengaroni

unread,
Jan 9, 2017, 5:28:57 AM1/9/17
to DroidScript
i use the same apk i have yused for make test on 6.0 platform.
i installed it on my wife ASUS mobile  for make a test with another environment. in mine work all as well.
No fault  in ASUS mobile, no athrer uses for GPS sensor.
my code, ( you can read it in the thread ) is set :


function StartLocator ()
{
     loc = app.CreateLocator("GPS,Network");

     loc.SetOnChange(loc_OnChange);
     loc.Start();
}


maybe a bug droidscrip api.





Steve Garman

unread,
Jan 9, 2017, 7:20:49 AM1/9/17
to DroidScript
You really have not given us enough information to decide whether this is a DS bug or not.

I know you think you know what is happening but the limited code you posted leaves all sorts of possibilities.

The locator certainly works on the only 6.0.1 device I have.

If I was seeing the problem you are, I would try to narrow down the exact point at which the code starts working.

I would start by making an apk of the code below and try running it on the Asus to see when it stops.

var counter = 0;
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
txt = app.CreateText( "",1,0.8, "log");
lay.AddChild( txt );

btn = app.CreateButton( "Test" );
btn.SetOnTouch( btn_OnTouch );
lay.AddChild( btn );

app.AddLayout( lay );
}

function btn_OnTouch()
{
txt.Log( "Button pressed" );
this.SetEnabled( false );
//Create and start location sensor.
//(Achievable update rate is hardware specific)
loc = app.CreateLocator( "GPS" );
loc.SetOnChange( loc_OnChange );
loc.SetRate( 2); //10 seconds.
txt.Log("Starting");
loc.Start();
txt.Log("Started");
int = setInterval(running,500)
}

function loc_OnChange(data)
{
clearInterval(int);
txt.Log("OnChange");
loc.Stop();
app.Alert(JSON.stringify(data,null,1),null,"noDim");
// btn.SetEnabled( true );
}

function running()
{
txt.Log(++counter);
}

Reply all
Reply to author
Forward
0 new messages