Re: [android-developers] threading : two independent events

2012-01-19 Thread vishal garg
Hi mark,

I feel I explained things loosely. Let me get into the specifics. I
have an application which does two things - collects GPS data and
sends to server in the backend and on frontend shows a
website(contains my customized maps). I am trying to get things work
simultaneously and it works fine on emulator but when I tested it on
the real device - samsung galaxy ace; the thing worked. Now, here is
the problem - if I analyze the data, though the application started
the GPS location finder but never sent anything to server. The website
loads once partially and then afterwards the whole application is
hung.

I tried to incorporate threading and Asynctask class but no solution -
gave Application Not Responding(ANR) error. Would like if anyone could
refer to similar examples or suggest a solution.

Code :
=
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

//downloading the website
setupWebView();
//getting the GPS coordinates and sending to server
getLocation();
}

private void getLocation() {
LocationManager locationManager =
  (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String provider = locationManager.getBestProvider(criteria,true);
locationManager.requestLocationUpdates(provider, 1, 0, this);
}

 private void setupWebView(){   
  webView = (WebView) findViewById(R.id.webview);
  webView.setWebViewClient(new HelloWebViewClient());
  webView.getSettings().setJavaScriptEnabled(true);
  webView.loadUrl(MAP_URL);
  }
=
Thanks.

-vishal garg


On Sat, Jan 14, 2012 at 5:25 PM, Mark Murphy  wrote:
> On Sat, Jan 14, 2012 at 1:41 AM, vishal garg  wrote:
>> I have an android app code where
>>
>> 1) 1st process : checks for user location constantly after every t
>> minutes.
>> 2) 2nd process : displays an image on the screen
>
> Why are these two processes? 99.99% of Android applications do not
> need more than one process. There is nothing in this description that
> would justify the cost to the user in CPU, RAM, and battery from your
> decision.
>
>> The processes are independent and but the code gets stuck in the first
>> process as a result of which second process does not load. I am
>> thinking of using threading to resolve but unable to understand/find
>> documentation. Please help.
>
> Please ask specific questions, not just "please help".
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in NYC: http://marakana.com/training/android/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] threading : two independent events

2012-01-13 Thread vishal garg
Hi,

I have an android app code where

1) 1st process : checks for user location constantly after every t
minutes.
2) 2nd process : displays an image on the screen

The processes are independent and but the code gets stuck in the first
process as a result of which second process does not load. I am
thinking of using threading to resolve but unable to understand/find
documentation. Please help.

I read : http://developer.android.com/resources/articles/painless-threading.html
and was able to figure out very less from it.

-vishal garg

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: buy more than one Android Dev Phone 1.

2011-08-01 Thread vishal garg
Thnx for your reply.

-vishal garg

On Mon, Aug 1, 2011 at 4:44 PM, Raghav Sood  wrote:
> You can test on any android phone/tablet. Dev phones are already rooted. You
> can buy them through your developer account.
> Thanks
>
> On Mon, Aug 1, 2011 at 4:10 PM, suleimaan  wrote:
>>
>> Hi,
>>
>> I am new in the android area. I need to test my app on a physical
>> device. Could you guide me how to buy an android development phone /
>> android testing device? I searched and got on this page :
>>
>> http://developer.android.com/guide/developing/device.html
>>
>> -vishal garg
>>
>> On Dec 15 2009, 6:59 pm, Mauro Conti  wrote:
>> > Dear all,
>> >  I am working on a research project and we need
>> > tobuysomeAndroidDevPhones.
>> > Is there any way a University canbuydirectly more than
>> > oneAndroidDevPhone?
>> > Is the only way to have a registered developer and single delivery for
>> > eachphone?
>> > Thanks.
>> > Regards,
>> >  Mauro Conti
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> Raghav Sood
> http://www.raghavsood.com/
> http://wiki.androidappcheck.com/
> http://www.telstop.tel/
> https://market.android.com/developer?pub=Appaholics
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en