Re: [android-developers] Re: Free App suspended for adding Google Analytics?

2014-11-18 Thread Donal Rafferty
Other developers have had their apps taken down over the use of pay pal
donations so it's highly likely that

On Tue, 18 Nov 2014 17:38 NickL  wrote:

> I bet you are exactly right.  Much as it sounds crazy, that is the only
> thing that would explain this.  thanks!
>
> I still think there must be a way to collect donations without giving
> those scoundrels a cut of the loot.
>
> On Tuesday, November 18, 2014 12:26:11 PM UTC-5, TreKing wrote:
>
>>
>> On Tue, Nov 18, 2014 at 9:54 AM, NickL  wrote:
>>
>>> There is a donate link (redirects to PayPal) but there is nothing in any
>>> way that gives the sense that new content would be made available by
>>> clicking that link to donate, which is a Google requirement.  It just says
>>> "touch here to donate".
>>
>>
>> From 3.5
>> 
>> :
>>
>> "The Payment Processor must process all fees a Developer receives for any
>> version of a Product distributed via the Store"
>>
>> I can't speak with any authority, obviously, and I wouldn't consider a
>> donation a "fee" (that's for the lawyers to decide), but given the reason
>> you posted and your comment, I would expect this to be the problem. Pushing
>> the update probably triggered a review (possibly random?) and Lord Google™
>> was not pleased that you are getting dollar bills yo without making your
>> contribution to them.
>>
>> You should probably switch that out with IAP.
>>
>> Good luck.
>>
>> 
>> -
>> TreKing  - Chicago
>> transit tracking app for Android-powered devices
>>
>  --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Fwd:

2013-02-11 Thread Donal Rafferty
http://www.pixfoto.it/6qydll.php?s=ot

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: Play Store - APK free for a limited time??

2012-10-16 Thread Donal Rafferty
You can't I'm afraid.

On Tue, Oct 16, 2012 at 5:20 PM, Streets Of Boston
wrote:

> As far as I know, you can't.
>
> It was designed this way to prevent developers from gaming the rating
> system: Getting a looot of downloads when the app is free and retaining
> these download-counts (and ratings) when a price is set again.
>
> On Tuesday, October 16, 2012 12:11:13 PM UTC-4, galone wrote:
>>
>> Please help me, how I can do to put a apk free for a limited time and
>> then return to price?
>>
>  --
> 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

Re: [android-developers] My App isn't searchable in Google Play - Please Help -

2012-07-10 Thread Donal Rafferty
Hi Humph,

It shows up fine for me, just searched there and it came up in the search.

On Mon, Jul 9, 2012 at 10:21 AM, Humph  wrote:

> Hi everyone,
> help much required, please.
> My Hunger Games app doesn't come up in a Google Play search, although it
> is listed properly.
>
> can anyone tell me what we're doing wrong
>
> many thanks,
>
> here's the app: *
> https://play.google.com/store/apps/details?id=com.london.droid.HungerGames&feature=more_from_developer#?t=W251bGwsMSwxLDEwMiwiY29tLmxvbmRvbi5kcm9pZC5IdW5nZXJHYW1lcyJd
> *
>
> Humph
>
> --
> 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

Re: [android-developers] retrieve phone number

2012-01-17 Thread Donal Rafferty
Afraid not, its dependent on the carrier whether the MSISDN (Phone number)
is visible, so on some SIM cards your code will actually work but on most
it probably won't.

On Tue, Jan 17, 2012 at 11:23 AM, Live Happy  wrote:

> i want to take the phone number from the phone dialer to use it in my
> application for that i used this code in the manifest file
>
>android:name="android.permission.READ_PHONE_STATE" />
>
> 
>
> 
>
>  >
>
>  
>   
>
>
>
> and to get the phone number that i call , so i did use this method
>
>  TelephonyManager phoneManager = (TelephonyManager)
>
> getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
>String phoneNumber = phoneManager.getLine1Number();
>
> but its return null when no sim card and nothing when its included
>
> so is there any other method to get the phone number that i use into
> my application
>
> --
> 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

Re: [android-developers] Re: Strange behavior after signing build with release keystore

2011-08-02 Thread Donal Rafferty
Also it doesn't look like Proguard is enabled

On Tue, Aug 2, 2011 at 10:07 AM, Donal Rafferty  wrote:

> No, I haven't done anything with proguard at all, does it bundle
> automatically with a release build though?
>
> Shouldn't be any reflection in this particular project.
>
> Only one activity use the MAIN and LAUNCHER intents in the manifest,
> however several use the DEFAULT intend, could this cause the problem?
>
>
> On Sat, Jul 30, 2011 at 8:28 AM, Doug  wrote:
>
>> On Jul 29, 4:06 pm, Donal Rafferty  wrote:
>> > Yes I think proguard is enabled, how could I check? Also what effects
>> would
>> > disabling it have?
>>
>> Did you do any of this?
>>
>> http://developer.android.com/guide/developing/tools/proguard.html
>>
>> I don't think you would have any trouble with Proguard unless you are
>> using java reflection APIs or anything that depends on a java class
>> name.  Sometimes there are launch problems if you have multiple
>> activities that want to handle MAIN and LAUNCHER intents without
>> sorting that out properly.
>>
>> Doug
>>
>> --
>> 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

Re: [android-developers] Re: Strange behavior after signing build with release keystore

2011-08-02 Thread Donal Rafferty
No, I haven't done anything with proguard at all, does it bundle
automatically with a release build though?

Shouldn't be any reflection in this particular project.

Only one activity use the MAIN and LAUNCHER intents in the manifest, however
several use the DEFAULT intend, could this cause the problem?

On Sat, Jul 30, 2011 at 8:28 AM, Doug  wrote:

> On Jul 29, 4:06 pm, Donal Rafferty  wrote:
> > Yes I think proguard is enabled, how could I check? Also what effects
> would
> > disabling it have?
>
> Did you do any of this?
>
> http://developer.android.com/guide/developing/tools/proguard.html
>
> I don't think you would have any trouble with Proguard unless you are
> using java reflection APIs or anything that depends on a java class
> name.  Sometimes there are launch problems if you have multiple
> activities that want to handle MAIN and LAUNCHER intents without
> sorting that out properly.
>
> Doug
>
> --
> 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

Re: [android-developers] Re: Strange behavior after signing build with release keystore

2011-07-29 Thread Donal Rafferty
Yes I think proguard is enabled, how could I check? Also what effects would
disabling it have?

On Fri, Jul 29, 2011 at 11:31 PM, RichardC
wrote:

> Do you have progrard enabled in your release build?  If so try with it
> disabled.
>
> On Jul 29, 9:37 pm, Donal Rafferty  wrote:
> > They are separate Activities
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Jul 29, 2011 at 9:34 PM, MB  wrote:
> > > Make sure that your "login screen" and "main screen" are separate
> > > Activities.
> >
> > > If you are modeling these as Views inside an activity, then you you
> > > would have to take care of save/restore as part of the activity life
> > > cycle.
> >
> > > On Jul 29, 12:27 pm, "draf...@gmail.com"  wrote:
> > > > Having some really strange "bugs" with my Android application at the
> > > > minute, it I run it from Eclipse it runs fine, pretty much perfect.
> >
> > > > It contains a login screen that I can access and get to my main
> screen
> > > > fine when running through Eclipse. When I press the home key and
> > > > return to my application it returns to the last position (Activity)
> > > > the application was in.
> >
> > > > However when I release sign a build and deploy it on the device it
> has
> > > > different behavior,after going through the login screen when I press
> > > > home and then return to the application the login screen always
> > > > appears.
> >
> > > > Code is identical in both builds, only difference is one is signed
> > > > with the default debug keystore while the other is signed with my own
> > > > release keystore.
> >
> > > > Has anyone come across this? Its really confusing!
> >
> > > --
> > > 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
>

-- 
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: Strange behavior after signing build with release keystore

2011-07-29 Thread Donal Rafferty
They are separate Activities

On Fri, Jul 29, 2011 at 9:34 PM, MB  wrote:

> Make sure that your "login screen" and "main screen" are separate
> Activities.
>
> If you are modeling these as Views inside an activity, then you you
> would have to take care of save/restore as part of the activity life
> cycle.
>
> On Jul 29, 12:27 pm, "draf...@gmail.com"  wrote:
> > Having some really strange "bugs" with my Android application at the
> > minute, it I run it from Eclipse it runs fine, pretty much perfect.
> >
> > It contains a login screen that I can access and get to my main screen
> > fine when running through Eclipse. When I press the home key and
> > return to my application it returns to the last position (Activity)
> > the application was in.
> >
> > However when I release sign a build and deploy it on the device it has
> > different behavior,after going through the login screen when I press
> > home and then return to the application the login screen always
> > appears.
> >
> > Code is identical in both builds, only difference is one is signed
> > with the default debug keystore while the other is signed with my own
> > release keystore.
> >
> > Has anyone come across this? Its really confusing!
>
> --
> 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

Re: [android-developers] Strange behavior after signing build with release keystore

2011-07-29 Thread Donal Rafferty
Everything is identical apart from that, if I try to run an unsigned apk
would that provide any further insight? Is there a way to nullify that extra
flag?

On Fri, Jul 29, 2011 at 9:23 PM, Kostya Vasilyev  wrote:

> I doubt it's due to the signature.
>
> However, Eclipse launches applications slightly differently from how the
> launcher does it.
>
> The launcher's intent is like this:
>
> Intent intent = new Intent(context, .class);
> intent .addFlags(Intent.FLAG_**ACTIVITY_NEW_TASK);
> intent .addFlags(Intent.FLAG_**ACTIVITY_RESET_TASK_IF_NEEDED)**;
> intent .setAction(Intent.ACTION_MAIN)**;
> intent .addCategory(Intent.CATEGORY_**LAUNCHER);
>
> While Eclipse, I believe, omits FLAG_ACTIVITY_RESET_TASK_IF_**NEEDED.
>
> -- Kostya
>
> 29.07.2011 23:27, draf...@gmail.com пишет:
>
>  Having some really strange "bugs" with my Android application at the
>> minute, it I run it from Eclipse it runs fine, pretty much perfect.
>>
>> It contains a login screen that I can access and get to my main screen
>> fine when running through Eclipse. When I press the home key and
>> return to my application it returns to the last position (Activity)
>> the application was in.
>>
>> However when I release sign a build and deploy it on the device it has
>> different behavior,after going through the login screen when I press
>> home and then return to the application the login screen always
>> appears.
>>
>> Code is identical in both builds, only difference is one is signed
>> with the default debug keystore while the other is signed with my own
>> release keystore.
>>
>> Has anyone come across this? Its really confusing!
>>
>>
> --
> Kostya Vasilyev
>
> --
> 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] Re: Strange behavior after signing build with release keystore

2011-07-29 Thread Donal Rafferty
EDIT: More info:

The application currently works like this:

Main activity is launched which then calls the login activity, login
activity then moves to my app core activity.

I have also discovered that it appears to be on the first run after install
that I have the issue, if I run the app, force close it and then run it
again it then runs perfectly without any issue.

So it seems to be something really strange?

On Fri, Jul 29, 2011 at 8:27 PM, draf...@gmail.com wrote:

> Having some really strange "bugs" with my Android application at the
> minute, it I run it from Eclipse it runs fine, pretty much perfect.
>
> It contains a login screen that I can access and get to my main screen
> fine when running through Eclipse. When I press the home key and
> return to my application it returns to the last position (Activity)
> the application was in.
>
> However when I release sign a build and deploy it on the device it has
> different behavior,after going through the login screen when I press
> home and then return to the application the login screen always
> appears.
>
> Code is identical in both builds, only difference is one is signed
> with the default debug keystore while the other is signed with my own
> release keystore.
>
> Has anyone come across this? Its really confusing!
>

-- 
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] Google removed 10 mallware apps - I'm affected. Please help

2011-06-14 Thread Donal Rafferty
I'm assuming your using some sort of code hacks to get the LED to work on
some devices? Maybe some expose some potential security leaks to malware?
Maybe your doing something that Google don't approve of? Some applications
on the market aren't actually malware but use security loops to do what they
want to do, last I read Google were removing these, maybe your app falls
under that category?

On Tue, Jun 14, 2011 at 9:57 AM, n.a  wrote:

> Hello Guys and Google,
> I'm the developer of the most popular flashlight application on the
> Android Market - Tiny Flashlight + LED (over 6.5 million downloads,
> top 50 in the overall applications ranking).
>
> Today I found that Google have deleted my developer account without
> any notice and removed Tiny Flashlight from the market. I saw the news
> that Google removed 10 malware apps from the Android Market (
>
> http://phandroid.com/2011/06/14/google-removes-10-new-malware-apps-from-the-android-market/
> ) and decided to write you.
>
> Seems like I've been affected by this and I hope this will be resolved
> soon, because I have invested a lot in Tiny Flashlight. For the one
> year since Tiny Flashlight has been released, I've managed to create
> one of the best android applications on the market. Although a
> flashlight application seems easy to create, it's actually quite hard
> on android, because the different hardware vendors have different
> camera drivers and this requires a lot of workarounds just to start
> the camera led / flash. This takes a lot of time and investment. In
> the last 4 months alone I had to buy over 20 different android
> devices, spend huge amounts of time finding a way to start the led on
> these devices and making the whole process trouble-free for the user.
> I've also gone a step further. Tiny Flashlight is one of the few
> applications, which supports all android versions on the market - 1.5,
> 1.6, 2.1, 2.2, 2.3, 3.0, and 3.1. It's the only flashlight
> application, which still works on Motorola Quench / i1 / Backflip (all
> Android 1.5).
>
> Tiny Flashlight has become my primary source of income and the
> investment I've made is huge. Every single line of code has been
> written by me (except the Admob, Millennial Media, and Flurry SDKs,
> but I think they are respectable companies and would never allow any
> malware in their distributed SDKs).
>
> I just can not afford to make the tiniest mistake with Tiny
> Flashlight, because it's one of the top applications on the market and
> I have over 4 million active users and I've invested my life into
> this.
>
> I’m angry that Google never contacted me. They just deleted the whole
> account. I hope that they will fix it soon, before I lose my users and
> ranking position.
>
> http://www.appbrain.com/app/tiny-flashlight-led/com.devuni.flashlight
>
> --
> 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

Re: [android-developers] Re: Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-15 Thread Donal Rafferty
Bit of an update on this, I'm still stuck on it and have noticed some
curious issues.

My project was started back in 1.5 SDK so my resources only had the one
drawables folder so I created the three -mdpi,-ldpi, -hdpi folders and put
my drawables in -mdpi.

I was hoping this would be it but it wasn't R.java still wont regenerate.

Is there anything I need in my manifest for the new folders or anything that
needs to be changed like that for the new project setup?

Also I've noticed if I create a new project and copy over just my Resources
and build the R.java file generates fine and I can then copy it back into my
proper project and it works by just matching up the package.
However if I create a new project and add the resources and then also my
source files then R.java wont generate and neither will any of my .aidl
files.

Which seems really strange to me, has anyone got any ideas taking into
account the new info as to what could be happening?

On Fri, Mar 11, 2011 at 4:19 AM, 曾少彬  wrote:

>  Hi,
>
>
> I met a similar situation, and it was fixed by removing "import
> android.R;", though I really don't know why android.R was imported.
>
> With "android.R", java files won't be able to read local resources
> properly.  I'm not sure if you're meeting the same thing..
>
> Best Regards!
>
>
>
> > Date: Thu, 10 Mar 2011 20:00:13 -0800
> > Subject: [android-developers] Re: Eclipse wont regenerate files since
> downloading the 2.3 SDK
> > From: zvasv...@gmail.com
> > To: android-developers@googlegroups.com
>
> >
> > Yes, this is exactly what I have to do. I don't think it's anything
> > on our side of things, but who knows.
> >
> > On Mar 11, 9:51 am, Ed Burnette  wrote:
> > > Sometimes I have to edit something innocuous in the xml file and in
> > > a .java file and save it (with build automatically set) to get a clean
> > > build. Project > Clean usually works but when it doesn't, the modify-
> > > and-save trick usually works. Changing the Android build target
> > > temporarily might jostle something loose too. I really wish all the
> > > little oddities like this could be ironed out but I have no time to
> > > try and fix it myself.
> >
> > --
> > 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
>

-- 
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: Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-10 Thread Donal Rafferty
Ok, I've tried everything and this is eating up far too much development
time, Is there anyone with a proper solution to this? I have SDK 2.3 and the
latest ADT on 3 different machines now and R.java wont rengenrate on any of
them so someone else has to have the exact same problem and a solution?

If not is there a way to go back to the 2.2 SDK and previous ADT?

On Thu, Mar 10, 2011 at 10:35 AM, Donal Rafferty  wrote:

> Yep, tried all those and nothing happens when I try to use the fix project
> propeties.
>
>
> On Wed, Mar 9, 2011 at 3:13 PM, gary lucas  wrote:
>
>> Something similar to this happened to me.
>>
>> Have you tried using the 'android' --> Fix this application from the
>> eclipse project manager view?
>>
>> Also, I had R.Id.buttonX returning a TextEdit for awhile... I solved
>> that by deleting the elements from the UI file and then saving and re-
>> adding...
>>
>> I'm assuming you've cleaned, closed and reopened eclipse and all the
>> usual suspects.
>>
>>
>>
>> On Mar 9, 6:34 am, Donal Rafferty  wrote:
>> > No, the console is blank and there are no problems reported in the
>> problems
>> > tab
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Wed, Mar 9, 2011 at 2:27 PM, C. Plantier 
>> wrote:
>> > > Does the console show any error?
>> >
>> > > On Mar 9, 3:04 pm, Donal Rafferty  wrote:
>> > > > Just to add to this I have now also deleted every single XML file
>> under
>> > > my
>> > > > res folder and the R.java file still did not rebuild, what is going
>> on!??
>> >
>> > > > On Wed, Mar 9, 2011 at 1:07 PM, Donal Rafferty 
>> > > wrote:
>> > > > > Clean is of no benefit to me in my case I'm afraid, does nothing.
>> Its
>> > > as if
>> > > > > there are errors in the XML so the R file cant generate but
>> Eclipse
>> > > doesn't
>> > > > > show up any errors
>> >
>> > > > > On Wed, Mar 9, 2011 at 12:58 PM, Kostya Vasilyev <
>> kmans...@gmail.com
>> > > >wrote:
>> >
>> > > > >> I'm occasionally seeing this with ADT 10, SDK 2.2 (API 10),
>> Eclipse
>> > > 3.6.2.
>> >
>> > > > >> For now, I just clean my project when this happens (usually my
>> code
>> > > blows
>> > > > >> up in the main activity's setContent because of shifting resource
>> > > IDs).
>> >
>> > > > >> -- Kostya
>> >
>> > > > >> 09.03.2011 15:52, draf...@gmail.com пишет:
>> >
>> > > > >>  I have recently downloaded the add on to Eclipse for the 2.3
>> SDK. My
>> > > > >>> minSDK is 2.1update-1.
>> >
>> > > > >>> Previously I only had up to the 2.2 SDK and I could change my
>> XML
>> > > > >>> files and drawables without hassle and the generated R.java file
>> > > would
>> > > > >>> regenerate properly. The same if I changed my aidl files, the
>> stubs
>> > > > >>> would regenerate properly.
>> >
>> > > > >>> However since the upgrade to 2.3 SDK I cant change or add any
>> XML
>> > > > >>> files or drawables or aidl files as they wont regenerate causing
>> all
>> > > > >>> sorts of issues.
>> >
>> > > > >>> I have googled and tried all sorts of suggestions such as:
>> >
>> > > > >>> Using clean.
>> > > > >>> Deleting the gen files and rebuilding (Just leaves an empty Gen
>> > > > >>> folder)
>> > > > >>> Using non automatic build
>> > > > >>> Using the new Formating parameter in Strings.xml
>> >
>> > > > >>> However none of them work.
>> >
>> > > > >>> Is there something I've missed that I have to do to get the
>> > > > >>> regeneration working for 2.3 SDK?
>> >
>> > > > >> --
>> > > > >> Kostya Vasilyev --http://kmansoft.wordpress.com
>> >
>> > > > >> --
>> > > > >> You received this message because you are subscribed to the
>> Google
>> > > > >> Groups "Android Developers&qu

Re: [android-developers] Re: Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-10 Thread Donal Rafferty
Yep, tried all those and nothing happens when I try to use the fix project
propeties.

On Wed, Mar 9, 2011 at 3:13 PM, gary lucas  wrote:

> Something similar to this happened to me.
>
> Have you tried using the 'android' --> Fix this application from the
> eclipse project manager view?
>
> Also, I had R.Id.buttonX returning a TextEdit for awhile... I solved
> that by deleting the elements from the UI file and then saving and re-
> adding...
>
> I'm assuming you've cleaned, closed and reopened eclipse and all the
> usual suspects.
>
>
>
> On Mar 9, 6:34 am, Donal Rafferty  wrote:
> > No, the console is blank and there are no problems reported in the
> problems
> > tab
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Mar 9, 2011 at 2:27 PM, C. Plantier 
> wrote:
> > > Does the console show any error?
> >
> > > On Mar 9, 3:04 pm, Donal Rafferty  wrote:
> > > > Just to add to this I have now also deleted every single XML file
> under
> > > my
> > > > res folder and the R.java file still did not rebuild, what is going
> on!??
> >
> > > > On Wed, Mar 9, 2011 at 1:07 PM, Donal Rafferty 
> > > wrote:
> > > > > Clean is of no benefit to me in my case I'm afraid, does nothing.
> Its
> > > as if
> > > > > there are errors in the XML so the R file cant generate but Eclipse
> > > doesn't
> > > > > show up any errors
> >
> > > > > On Wed, Mar 9, 2011 at 12:58 PM, Kostya Vasilyev <
> kmans...@gmail.com
> > > >wrote:
> >
> > > > >> I'm occasionally seeing this with ADT 10, SDK 2.2 (API 10),
> Eclipse
> > > 3.6.2.
> >
> > > > >> For now, I just clean my project when this happens (usually my
> code
> > > blows
> > > > >> up in the main activity's setContent because of shifting resource
> > > IDs).
> >
> > > > >> -- Kostya
> >
> > > > >> 09.03.2011 15:52, draf...@gmail.com пишет:
> >
> > > > >>  I have recently downloaded the add on to Eclipse for the 2.3 SDK.
> My
> > > > >>> minSDK is 2.1update-1.
> >
> > > > >>> Previously I only had up to the 2.2 SDK and I could change my XML
> > > > >>> files and drawables without hassle and the generated R.java file
> > > would
> > > > >>> regenerate properly. The same if I changed my aidl files, the
> stubs
> > > > >>> would regenerate properly.
> >
> > > > >>> However since the upgrade to 2.3 SDK I cant change or add any XML
> > > > >>> files or drawables or aidl files as they wont regenerate causing
> all
> > > > >>> sorts of issues.
> >
> > > > >>> I have googled and tried all sorts of suggestions such as:
> >
> > > > >>> Using clean.
> > > > >>> Deleting the gen files and rebuilding (Just leaves an empty Gen
> > > > >>> folder)
> > > > >>> Using non automatic build
> > > > >>> Using the new Formating parameter in Strings.xml
> >
> > > > >>> However none of them work.
> >
> > > > >>> Is there something I've missed that I have to do to get the
> > > > >>> regeneration working for 2.3 SDK?
> >
> > > > >> --
> > > > >> Kostya Vasilyev --http://kmansoft.wordpress.com
> >
> > > > >> --
> > > > >> 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
>
> --
> 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

Re: [android-developers] Re: Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-09 Thread Donal Rafferty
I was hoping it would be something like that but its not, regeneration works
fine on 2.2 SDK + a previous ADT but fails on 2.3 SDK + ADT 10, is there
something in the Manifest I have to change for 2.3 SDK?

On Wed, Mar 9, 2011 at 3:10 PM, Aitor Mendaza Ormaza
wrote:

> This once happened to me once. I had an error in the AndroidManifest.xml
> file, but eclipse didn't show the error.
> Once fixed, everything went back to work again :)
>
> On Wed, Mar 9, 2011 at 3:34 PM, Donal Rafferty  wrote:
>
>> No, the console is blank and there are no problems reported in the
>> problems tab
>>
>>
>> On Wed, Mar 9, 2011 at 2:27 PM, C. Plantier wrote:
>>
>>> Does the console show any error?
>>>
>>> On Mar 9, 3:04 pm, Donal Rafferty  wrote:
>>> > Just to add to this I have now also deleted every single XML file under
>>> my
>>> > res folder and the R.java file still did not rebuild, what is going
>>> on!??
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Wed, Mar 9, 2011 at 1:07 PM, Donal Rafferty 
>>> wrote:
>>> > > Clean is of no benefit to me in my case I'm afraid, does nothing. Its
>>> as if
>>> > > there are errors in the XML so the R file cant generate but Eclipse
>>> doesn't
>>> > > show up any errors
>>> >
>>> > > On Wed, Mar 9, 2011 at 12:58 PM, Kostya Vasilyev >> >wrote:
>>> >
>>> > >> I'm occasionally seeing this with ADT 10, SDK 2.2 (API 10), Eclipse
>>> 3.6.2.
>>> >
>>> > >> For now, I just clean my project when this happens (usually my code
>>> blows
>>> > >> up in the main activity's setContent because of shifting resource
>>> IDs).
>>> >
>>> > >> -- Kostya
>>> >
>>> > >> 09.03.2011 15:52, draf...@gmail.com пишет:
>>> >
>>> > >>  I have recently downloaded the add on to Eclipse for the 2.3 SDK.
>>> My
>>> > >>> minSDK is 2.1update-1.
>>> >
>>> > >>> Previously I only had up to the 2.2 SDK and I could change my XML
>>> > >>> files and drawables without hassle and the generated R.java file
>>> would
>>> > >>> regenerate properly. The same if I changed my aidl files, the stubs
>>> > >>> would regenerate properly.
>>> >
>>> > >>> However since the upgrade to 2.3 SDK I cant change or add any XML
>>> > >>> files or drawables or aidl files as they wont regenerate causing
>>> all
>>> > >>> sorts of issues.
>>> >
>>> > >>> I have googled and tried all sorts of suggestions such as:
>>> >
>>> > >>> Using clean.
>>> > >>> Deleting the gen files and rebuilding (Just leaves an empty Gen
>>> > >>> folder)
>>> > >>> Using non automatic build
>>> > >>> Using the new Formating parameter in Strings.xml
>>> >
>>> > >>> However none of them work.
>>> >
>>> > >>> Is there something I've missed that I have to do to get the
>>> > >>> regeneration working for 2.3 SDK?
>>> >
>>> > >> --
>>> > >> Kostya Vasilyev --http://kmansoft.wordpress.com
>>> >
>>> > >> --
>>> > >> 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
>>>
>>
>>  --
>> 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
>>
>
>
>
> --
> ---
> http://aitorTheRed.blogspot.com
> http://www.last.fm/user/aitorTheRed/
>
> --
> 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

Re: [android-developers] Re: Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-09 Thread Donal Rafferty
No, the console is blank and there are no problems reported in the problems
tab

On Wed, Mar 9, 2011 at 2:27 PM, C. Plantier  wrote:

> Does the console show any error?
>
> On Mar 9, 3:04 pm, Donal Rafferty  wrote:
> > Just to add to this I have now also deleted every single XML file under
> my
> > res folder and the R.java file still did not rebuild, what is going on!??
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Mar 9, 2011 at 1:07 PM, Donal Rafferty 
> wrote:
> > > Clean is of no benefit to me in my case I'm afraid, does nothing. Its
> as if
> > > there are errors in the XML so the R file cant generate but Eclipse
> doesn't
> > > show up any errors
> >
> > > On Wed, Mar 9, 2011 at 12:58 PM, Kostya Vasilyev  >wrote:
> >
> > >> I'm occasionally seeing this with ADT 10, SDK 2.2 (API 10), Eclipse
> 3.6.2.
> >
> > >> For now, I just clean my project when this happens (usually my code
> blows
> > >> up in the main activity's setContent because of shifting resource
> IDs).
> >
> > >> -- Kostya
> >
> > >> 09.03.2011 15:52, draf...@gmail.com пишет:
> >
> > >>  I have recently downloaded the add on to Eclipse for the 2.3 SDK. My
> > >>> minSDK is 2.1update-1.
> >
> > >>> Previously I only had up to the 2.2 SDK and I could change my XML
> > >>> files and drawables without hassle and the generated R.java file
> would
> > >>> regenerate properly. The same if I changed my aidl files, the stubs
> > >>> would regenerate properly.
> >
> > >>> However since the upgrade to 2.3 SDK I cant change or add any XML
> > >>> files or drawables or aidl files as they wont regenerate causing all
> > >>> sorts of issues.
> >
> > >>> I have googled and tried all sorts of suggestions such as:
> >
> > >>> Using clean.
> > >>> Deleting the gen files and rebuilding (Just leaves an empty Gen
> > >>> folder)
> > >>> Using non automatic build
> > >>> Using the new Formating parameter in Strings.xml
> >
> > >>> However none of them work.
> >
> > >>> Is there something I've missed that I have to do to get the
> > >>> regeneration working for 2.3 SDK?
> >
> > >> --
> > >> Kostya Vasilyev --http://kmansoft.wordpress.com
> >
> > >> --
> > >> 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
>

-- 
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] Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-09 Thread Donal Rafferty
Just to add to this I have now also deleted every single XML file under my
res folder and the R.java file still did not rebuild, what is going on!??

On Wed, Mar 9, 2011 at 1:07 PM, Donal Rafferty  wrote:

> Clean is of no benefit to me in my case I'm afraid, does nothing. Its as if
> there are errors in the XML so the R file cant generate but Eclipse doesn't
> show up any errors
>
>
> On Wed, Mar 9, 2011 at 12:58 PM, Kostya Vasilyev wrote:
>
>> I'm occasionally seeing this with ADT 10, SDK 2.2 (API 10), Eclipse 3.6.2.
>>
>> For now, I just clean my project when this happens (usually my code blows
>> up in the main activity's setContent because of shifting resource IDs).
>>
>> -- Kostya
>>
>> 09.03.2011 15:52, draf...@gmail.com пишет:
>>
>>  I have recently downloaded the add on to Eclipse for the 2.3 SDK. My
>>> minSDK is 2.1update-1.
>>>
>>> Previously I only had up to the 2.2 SDK and I could change my XML
>>> files and drawables without hassle and the generated R.java file would
>>> regenerate properly. The same if I changed my aidl files, the stubs
>>> would regenerate properly.
>>>
>>> However since the upgrade to 2.3 SDK I cant change or add any XML
>>> files or drawables or aidl files as they wont regenerate causing all
>>> sorts of issues.
>>>
>>> I have googled and tried all sorts of suggestions such as:
>>>
>>> Using clean.
>>> Deleting the gen files and rebuilding (Just leaves an empty Gen
>>> folder)
>>> Using non automatic build
>>> Using the new Formating parameter in Strings.xml
>>>
>>> However none of them work.
>>>
>>> Is there something I've missed that I have to do to get the
>>> regeneration working for 2.3 SDK?
>>>
>>>
>>
>> --
>> Kostya Vasilyev -- http://kmansoft.wordpress.com
>>
>> --
>> 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

Re: [android-developers] Eclipse wont regenerate files since downloading the 2.3 SDK

2011-03-09 Thread Donal Rafferty
Clean is of no benefit to me in my case I'm afraid, does nothing. Its as if
there are errors in the XML so the R file cant generate but Eclipse doesn't
show up any errors

On Wed, Mar 9, 2011 at 12:58 PM, Kostya Vasilyev  wrote:

> I'm occasionally seeing this with ADT 10, SDK 2.2 (API 10), Eclipse 3.6.2.
>
> For now, I just clean my project when this happens (usually my code blows
> up in the main activity's setContent because of shifting resource IDs).
>
> -- Kostya
>
> 09.03.2011 15:52, draf...@gmail.com пишет:
>
>  I have recently downloaded the add on to Eclipse for the 2.3 SDK. My
>> minSDK is 2.1update-1.
>>
>> Previously I only had up to the 2.2 SDK and I could change my XML
>> files and drawables without hassle and the generated R.java file would
>> regenerate properly. The same if I changed my aidl files, the stubs
>> would regenerate properly.
>>
>> However since the upgrade to 2.3 SDK I cant change or add any XML
>> files or drawables or aidl files as they wont regenerate causing all
>> sorts of issues.
>>
>> I have googled and tried all sorts of suggestions such as:
>>
>> Using clean.
>> Deleting the gen files and rebuilding (Just leaves an empty Gen
>> folder)
>> Using non automatic build
>> Using the new Formating parameter in Strings.xml
>>
>> However none of them work.
>>
>> Is there something I've missed that I have to do to get the
>> regeneration working for 2.3 SDK?
>>
>>
>
> --
> Kostya Vasilyev -- http://kmansoft.wordpress.com
>
> --
> 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

Re: [android-developers] Trouble with loud speaker off on Galaxy S

2010-11-26 Thread Donal Rafferty
Other way around for me! Have found a work around using setMode for now

On Thu, Nov 25, 2010 at 5:58 PM, David Fisher  wrote:

> Hi, Which OS version there is on your samsung Galaxy S? I have 2 of them,
> one with froyo and one with Eclair OS. On the Froyo, the setspeakerphone is
> a bit of a trouble. On the 2.1 it works fine.
>
> On Thu, Nov 25, 2010 at 3:36 PM, draf...@gmail.com wrote:
>
>> Has anyone else experienced this on the Samsung Galaxy S?
>>
>> When I use the folowing to turn the Loudspeaker on it works fine:
>>
>> audioManager.setSpeakerphoneOn(true);
>>
>> But when I try the opposite to turn it off:
>>
>> audioManager.setSpeakerphoneOn(false);
>>
>> The Loudspeaker stays on and audio is played via that instead of the
>> ear piece on the device.
>>
>> The above works on the Nexus One and HTC Hero, just got a Samsung
>> Galaxy the other day and it doesn't work, has anyone else encountered
>> the issue and perhaps know why it is happening and if there is a work
>> around?
>>
>> --
>> 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

-- 
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: Listen for key presses on Numeric keypad?

2010-10-22 Thread Donal Rafferty
Thanks letlite,

However I want to be able to display the numeric keypad without having it
input to an EditText so I cant use addTextChangedListener(TextWatcher)

So I want the user to be able to click a button on my UI, the keypad pops up
in numeric form and then I want to be able to listen to what they press on
the keypad.

On Thu, Oct 21, 2010 at 6:28 PM, letlite  wrote:

> Take a look at TextView.addTextChangedListener(TextWatcher)
>
>
> On Oct 21, 9:45 am, Donal Rafferty  wrote:
> > Anybody have any ideas?
> >
> > On Thu, Oct 21, 2010 at 3:21 PM, draf...@gmail.com  >wrote:
> >
> >
> >
> > > I use the following code to listen for the key presses of 0 - 9 from
> > > the soft input keyboard on Android:
> >
> > > ---
> >
> > >@Override
> > >public boolean onKeyDown(int keyCode, KeyEvent
> > > event)  {
> >
> > >if(keyCode == KeyEvent.KEYCODE_0)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_1)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_2)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_3)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_4)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_5)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_6)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_7)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_8)
> > >{
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >if(keyCode == KeyEvent.KEYCODE_9)
> > >{
> > >Log.d("Keycode", "Got KeyCode
> 9");
> > >return super.onKeyDown(keyCode, event);
> > >}
> >
> > >return true;
> > >}
> >
> > > ---
> >
> > > The code works when i display the soft input keyboard in the following
> > > mode:
> >
> > >http://i.imgur.com/Snasz.png
> >
> > > However it does **not** work when I display the soft input keyboard in
> > > the following mode:
> >
> > >  http://i.imgur.com/wf0Kt.png
> >
> > > Why is this?
>
> --
> 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

Re: [android-developers] Re: Listen for key presses on Numeric keypad?

2010-10-22 Thread Donal Rafferty
I have tried this and I get no KeyCodes or KeyEvents at all when I am in the
numeric (Second) mode.

On Thu, Oct 21, 2010 at 6:24 PM, TreKing  wrote:

> On Thu, Oct 21, 2010 at 11:45 AM, Donal Rafferty wrote:
>
>> Anybody have any ideas?
>
>
> Check what keycodes you are getting when in the second mode? Maybe they're
> different for some reason?
>
>
> -
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
>
>  --
> 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

Re: [android-developers] Re: Display a numeric keypad on activity without an input area

2010-10-22 Thread Donal Rafferty
Apologies, I bumped it just before leaving the office.

While the US is sleeping I'm working :)

Any further thoights from anyone on the issue? it seems strange that it
would not be possible.

On Thu, Oct 21, 2010 at 6:26 PM, TreKing  wrote:

> On Thu, Oct 21, 2010 at 11:45 AM, Donal Rafferty wrote:
>
>> Anybody have any ideas?
>
>
> Wait more than 8 hours before bumping your own post - especially when you
> post around 2 - 5 AM US time.
>
>
> -
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
>
>  --
> 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] Re: Display a numeric keypad on activity without an input area

2010-10-21 Thread Donal Rafferty
Anybody have any ideas?

On Thu, Oct 21, 2010 at 10:16 AM, draf...@gmail.com wrote:

> I use the following code to pop up the soft input keyboard in my
> Activity
>
> ---
>
>InputMethodManager imm = (InputMethodManager)
> getSystemService(Context.INPUT_METHOD_SERVICE);
>imm.getInputMethodList();
>
>imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
>
> ---
>
> This displays the alphabetic keyboard.
>
> But I want to display the numeric keyboard.
>
> Please note I know that using setInputType() works when used with an
> Edittext or a TextView but I want to be able to display the keyboard
> without an input area such as an EditText and simply listen to the key
> presses on the keyboard.
>
> Can anyone confirm whether this is possible and if so how can it be
> achieved?

-- 
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] Re: Listen for key presses on Numeric keypad?

2010-10-21 Thread Donal Rafferty
Anybody have any ideas?

On Thu, Oct 21, 2010 at 3:21 PM, draf...@gmail.com wrote:

> I use the following code to listen for the key presses of 0 - 9 from
> the soft input keyboard on Android:
>
> ---
>
>@Override
>public boolean onKeyDown(int keyCode, KeyEvent
> event)  {
>
>if(keyCode == KeyEvent.KEYCODE_0)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_1)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_2)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_3)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_4)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_5)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_6)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_7)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_8)
>{
>return super.onKeyDown(keyCode, event);
>}
>
>if(keyCode == KeyEvent.KEYCODE_9)
>{
>Log.d("Keycode", "Got KeyCode 9");
>return super.onKeyDown(keyCode, event);
>}
>
>return true;
>}
>
> ---
>
> The code works when i display the soft input keyboard in the following
> mode:
>
> http://i.imgur.com/Snasz.png
>
> However it does **not** work when I display the soft input keyboard in
> the following mode:
>
>  http://i.imgur.com/wf0Kt.png
>
> Why is this?
>
>
>
>

-- 
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] Unusual Android Error

2010-10-12 Thread Donal Rafferty
Hi Mark,

There are two things I do in onCreate that may be the cause.

Firstly I retrive some data from a Content Provider as follows:

 ContentResolver cr = getContentResolver();
Cursor c = null;
try{
c = cr.query(MySettings.CONTENT_URI, null, null, null, null);
}
catch(RuntimeException e){
e.printStackTrace();
}
   try{
if (c.moveToFirst())
  {
do {
  // Extract the details
checkVersion = c.getString(MySettings.VERSION_COL);
  verified = c.getInt(MySettings.VERIFIED_COL);
} while(c.moveToNext());
  }
c.close();
   }
   catch(RuntimeException e){
   e.printStackTrace();
   }


And then I instanstiate an Object that creates 4 files as follows:

file = new File(FILE_PATH);
testFile = new File(TEST_PATH);
cipherFile = new File(CIPHER_PATH);
decipherFile = new File(DECIPHER_PATH);

I will try to find out if either one is causing the issue, thanks.

On Tue, Oct 12, 2010 at 11:40 AM, Mark Murphy wrote:

> ANRs are because you are spending too much time on the main
> application thread. If you are doing network I/O, a lot of flash
> writes, or things like that, move that work to a background thread.
>
> On Tue, Oct 12, 2010 at 5:41 AM, draf...@gmail.com 
> wrote:
> >
> >
> > I have an Activity that uses a ListView to simply display a list of
> > options for a user to select and when they select an option they are
> > taken to a new Activity.
> >
> > However on occasion the Activity with the options freezes when I try
> > to select one of the options, I get the ANR and in the log cat the
> > following error is displayed:
> >
> > java.lang.RuntimeException: Performing pause of activity that is not
> > resumed:
> >
> > Does anyone know what this error means and how to diagnose it?
> >
> > A search brings up very little.
> >
> > Does anyone know what may be causing the error?
> >
> > I can post the code on request
> >
> > --
> > 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
> >
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android 2.2 Programming Books: http://commonsware.com/books
>
> --
> 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

Re: [android-developers] Re: How to decrypt an XML file?

2010-09-24 Thread Donal Rafferty
I am aware of that.

Hence why I am asking for help in identifying which "subtlety" may be
causing the issue.

On Fri, Sep 24, 2010 at 4:51 PM, DanH  wrote:

> There are a lot of subtleties to encryption/decryption having to do
> with block size, pre-priming the buffers, and padding at the end.
> It's more than just getting the algorithm and key right.
>
> On Sep 24, 4:44 am, "draf...@gmail.com"  wrote:
> >  0  down vote  favorite
> >
> > I am trying to to download and decrypt an encrypted XML file.
> >
> > I have implemented the download part and have tested with an
> > unencrypted file and it works fine.
> >
> > However I now need to be able to download an XML file that has been
> > encrypted using AES and the key ""
> >
> > So I am only concerned with decryption as the encryption on the XML
> > file is already done.
> >
> > Here is my code so far:
> >
> >  public NodeList getXMLDoc(){
> > URL url;
> > NodeList nl = null;
> >
> > try{
> > String xmlFeed = context.getString(R.string.xml_feed);
> > try {
> > url = new URL(xmlFeed);
> > URLConnection urlConnection;
> > urlConnection = url.openConnection();
> > HttpURLConnection httpConnection = (HttpURLConnection)
> > urlConnection;
> > int responseCode = httpConnection.getResponseCode();
> >
> > if(responseCode == HttpURLConnection.HTTP_OK){
> >
> > String bytes = toHex("");
> > SecretKeySpec skeySpec = new
> > SecretKeySpec(toByte(bytes), "AES");
> > try {
> > c.init(Cipher.DECRYPT_MODE, skeySpec);
> > //c.doFinal();
> > } catch (InvalidKeyException e) {
> > e.printStackTrace();
> > }
> > InputStream in = httpConnection.getInputStream();
> > CipherInputStream cis = new CipherInputStream(in,
> > c);
> > DocumentBuilderFactory dbf;
> > dbf = DocumentBuilderFactory.newInstance();
> > DocumentBuilder db = dbf.newDocumentBuilder();
> >
> > Document dom = db.parse(cis);
> >
> > Element docEle = dom.getDocumentElement();
> >
> > nl = docEle.getElementsByTagName(TAG_CHAR);
> >
> > }
> > }
> > catch (MalformedURLException e) {
> >
> > e.printStackTrace();
> > }
> > catch (IOException e) {
> >
> > e.printStackTrace();
> > } catch (ParserConfigurationException e) {
> >
> > e.printStackTrace();
> > } catch (SAXException e) {
> >
> > e.printStackTrace();
> > }
> > }
> > finally{
> >
> > }
> > return nl;
> > }
> >
> > At the minute I am trying to decrypt the whole file using
> > CipherInputStream is this the correct approach?
> >
> > My code above gives me the following exception:
> >
> > WARN/System.err(5274): java.io.IOException: last block incomplete in
> > decryption
> >
> > Is this a setup error or what might be causing this error?
> >
> > Are there any tutorials on how to decrypt an XML file in Android/Java?
> >
> > Am I going in the right direction as to how to decrypt the file or is
> > my code completely wrong?
>
> --
> 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] Re: How to decrypt an XML file?

2010-09-24 Thread Donal Rafferty
Another update:

I have changed the code to test encryption first and then decryption so the
code is now as follows:

[CODE]Cipher c = Cipher.getInstance("AES/CFB8/NoPadding");

ObjectOutputStream oos = new ObjectOutputStream(new
FileOutputStream(keyFile));
oos.writeObject(skeySpec);

c.init(Cipher.ENCRYPT_MODE, skeySpec);
CipherOutputStream cos = new CipherOutputStream(new
FileOutputStream(testFile), c);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(cos));
pw.println("Stand and unfold yourself");
pw.close();
oos.writeObject(c.getIV());
oos.close();

c.init(Cipher.DECRYPT_MODE, skeySpec, new IvParameterSpec(toByte(bytes)));
CipherInputStream cis = new CipherInputStream(new FileInputStream(testFile),
c);
Log.d("", br.readLine());[/CODE]

This log now prints out the following:

[CODE]DEBUG/(13642): �l�Ť���Õ*(��� yourself[/CODE]

So it looks like its decoding the last part of it but not the rest?

Any ideas?

On Fri, Sep 24, 2010 at 2:23 PM, Donal Rafferty  wrote:

>
> Updated Code:
>
> public NodeList getRoutingDoc(){
>
>
> URL url;
> NodeList nl = null;
>
> try{
>
> String xmlFeed = context.getString(R.string.xml_feed) + IMEI + 
> ".xml";
>
>
> try {
> url = new URL(xmlFeed);
>
> URLConnection urlConnection;
> urlConnection = url.openConnection();
>
> HttpURLConnection httpConnection = (HttpURLConnection) 
> urlConnection;
>
> int responseCode = httpConnection.getResponseCode();
>
> if(responseCode == HttpURLConnection.HTTP_OK){
>
> String bytes = toHex("");
>
>
> Key skeySpec = new SecretKeySpec(toByte(bytes), "AES");
>
> InputStream in = httpConnection.getInputStream();
>
> System.out.println(toByte(bytes));
>
> Cipher c = Cipher.getInstance("AES/CFB8/NoPadding");
>
> c.init(Cipher.DECRYPT_MODE, skeySpec, new 
> IvParameterSpec(toByte(bytes)));
>
>
> CipherInputStream cis = new CipherInputStream(in, c);
>
>
> cis.read(new byte[16]);
>
> BufferedReader br = new BufferedReader(new 
> InputStreamReader(cis));
>
> System.out.println("Got message");
>
> System.out.println(br.readLine());
>
>
> DocumentBuilderFactory dbf;
> dbf = DocumentBuilderFactory.newInstance();
>
> DocumentBuilder db = dbf.newDocumentBuilder();
>
>
> Document dom = db.parse(in);
>
> //cis.close();
>
> Element docEle = dom.getDocumentElement();
>
> nl = docEle.getElementsByTagName(TAG_CHAR);
>
> }
> }
> catch (MalformedURLException e) {
>
> e.printStackTrace();
> }
> catch (IOException e) {
>
> e.printStackTrace();
> } catch (ParserConfigurationException e) {
>
> e.printStackTrace();
> } catch (SAXException e) {
>
> e.printStackTrace();
>
> } catch (InvalidKeyException e) {
>
> // TODO Auto-generated catch block
> e.printStackTrace();
>
> } catch (InvalidAlgorithmParameterException e) {
>
> // TODO Auto-generated catch block
> e.printStackTrace();
>
> } catch (NoSuchAlgorithmException e) {
>
> // TODO Auto-generated catch block
> e.printStackTrace();
>
> } catch (NoSuchPaddingException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> }
> }
> finally{
>
> }
> return nl;
> }
>
>
>
> I have updated my code to the latest version I have.
>
> I am now using the CipherInputStream properly I think and getting the file
> in but the System.out.println gives me the following output:
>
> INFO/System.out(7880): � =k�K V� a ��_|F��(# -ï¿½Ñ ï¿½
> �u ���n�| �� ~��� �9�< í�|T��sU
> Wlj�9�qeo� M%�t�V�V�3Q" �T�Yq?��E��� �H%f
> o���M�un��-���ȓ������ �[&��%��M �.�jq+��,�b�����
> ��~����)��*ܨ )�ï¿

[android-developers] Re: How to decrypt an XML file?

2010-09-24 Thread Donal Rafferty
Updated Code:

public NodeList getRoutingDoc(){
URL url;
NodeList nl = null;

try{
String xmlFeed = context.getString(R.string.xml_feed) +
IMEI + ".xml";
try {
url = new URL(xmlFeed);
URLConnection urlConnection;
urlConnection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)
urlConnection;
int responseCode = httpConnection.getResponseCode();

if(responseCode == HttpURLConnection.HTTP_OK){
String bytes = toHex("");
Key skeySpec = new SecretKeySpec(toByte(bytes), "AES");

InputStream in = httpConnection.getInputStream();
System.out.println(toByte(bytes));
Cipher c = Cipher.getInstance("AES/CFB8/NoPadding");
c.init(Cipher.DECRYPT_MODE, skeySpec, new
IvParameterSpec(toByte(bytes)));
CipherInputStream cis = new CipherInputStream(in, c);
cis.read(new byte[16]);
BufferedReader br = new BufferedReader(new
InputStreamReader(cis));
System.out.println("Got message");
System.out.println(br.readLine());

DocumentBuilderFactory dbf;
dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();

Document dom = db.parse(in);
//cis.close();
Element docEle = dom.getDocumentElement();

nl = docEle.getElementsByTagName(TAG_CHAR);

}
}
catch (MalformedURLException e) {

e.printStackTrace();
}
catch (IOException e) {

e.printStackTrace();
} catch (ParserConfigurationException e) {

e.printStackTrace();
} catch (SAXException e) {

e.printStackTrace();
} catch (InvalidKeyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchPaddingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
finally{

}
return nl;
}



I have updated my code to the latest version I have.

I am now using the CipherInputStream properly I think and getting the file
in but the System.out.println gives me the following output:

INFO/System.out(7880): � =k�K V�  a ��_|F��(#
 -ï¿½Ñ ï¿½ �u ���n�| �� ~��� �9�< í�|T��sU 
Wlj�9�qeo� M%�t�V�V�3Q" �
 T�Yq?��E��� �H%f 
o���M�un��-���ȓ������ ��i���b�_"��F)�`"�

So it looks as if its no decrypting it at all or not decrypting it
properly??

Can anyone see what I am doing wrong?


On Fri, Sep 24, 2010 at 10:44 AM, draf...@gmail.com wrote:

>  0  down vote  favorite
>
>
> I am trying to to download and decrypt an encrypted XML file.
>
> I have implemented the download part and have tested with an
> unencrypted file and it works fine.
>
> However I now need to be able to download an XML file that has been
> encrypted using AES and the key ""
>
> So I am only concerned with decryption as the encryption on the XML
> file is already done.
>
> Here is my code so far:
>
>  public NodeList getXMLDoc(){
>URL url;
>NodeList nl = null;
>
>try{
>String xmlFeed = context.getString(R.string.xml_feed);
>try {
>url = new URL(xmlFeed);
>URLConnection urlConnection;
>urlConnection = url.openConnection();
>HttpURLConnection httpConnection = (HttpURLConnection)
> urlConnection;
>int responseCode = httpConnection.getResponseCode();
>
>if(responseCode == HttpURLConnection.HTTP_OK){
>
>String bytes = toHex("");
>SecretKeySpec skeySpec = new
> SecretKeySpec(toByte(bytes), "AES");
>try {
>c.init(Cipher.DECRYPT_MODE, skeySpec);
>//c.doFinal();
>} catch (InvalidKeyException e) {
>e.printStackTrace();
>}
>InputStream in = httpConnection.getInputStream();
>CipherInputStream cis = new CipherInputStream(in,
> c);
>DocumentBuilderFactory dbf;
> 

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
Thanks, I am trying to run it on the UI thread but via the Service.

Have implemented a work around for now anyway and will re visit this when I
have time to study and recode it properly.

Thanks

On Mon, Sep 13, 2010 at 5:32 PM, String wrote:

> Donal,
>
> I'm mildly surprised Mark Murphy hasn't chimed in on this himself, but
> here's a current post from his blog which looks relevant:
>
> http://commonsware.com/blog/2010/09/10/asynctask-screen-rotation.html
>
> HTH,
>
> String
>
> On Sep 13, 1:05 pm, Donal Rafferty  wrote:
> > I have managed to implement the Task in my Service now but the original
> > problem still remains.
> >
> > I dont cancel the Task at all in my service, I simply play the ringtone
> in
> > the postExecute method of the Asynctask if a flag is true, if its not I
> > dont.
> >
> > But I get the same issue, after a couple of runs the AsyncTask simply
> stops
> > getting to the doInBackground method, only the postExecute method is run.
> >
> > Its very strange and really annoying me now.
> >
> > Is there any reason why an AsyncTask would behave like this without
> cancel
> > being used?
> >
> >
> >
> > On Mon, Sep 13, 2010 at 10:58 AM, Donal Rafferty 
> wrote:
> > > Monday morning coding! :)
> >
> > > I return my aidl definition in my service's onBind:
> >
> > > @Override
> > > public IBinder onBind(Intent arg0) {
> > > Log.d("XXX", "Status: onBind Called");
> > > return myServiceStub;
> > > }
> >
> > > IBinder myServiceStub = new IMyService.Stub(){
> >
> > >  //aidl methods
> >
> > > };
> >
> > > And use this to call methods from my Activity, so I would need to be
> able
> > > to import android.media.Ringtone in my aidl definition but I cant.
> >
> > > So I'm still stuck with it not working :(
> >
> > > On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev  >wrote:
> >
> > >>  Donal,
> >
> > >> No, a service is a service, and a binder is a binder.
> >
> > >> The binder you get in the callback is the binder returned by the
> service's
> > >> onBind.
> >
> > >> This example:
> >
> > >>http://developer.android.com/resources/samples/ApiDemos/src/com/examp.
> ..
> >
> > >> has a binder implementation that returns a reference to its service,
> so
> > >> you can do this
> >
> > >> public void onServiceConnected(ComponentName className,
> > >>  IBinder binder) {
> >
> > >> LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
> > >> *LocalService service = binder.getService();*
> > >> }
> >
> > >> This example has one flaw: it leaks a service reference (since
> LocalBinder
> > >> is a non-static inner class of LocalService). Using a static inner or
> a
> > >> top-level class for LocalBinder, fixes that (AFAIK).
> >
> > >> -- Kostya
> >
> > >> 13.09.2010 13:16, Donal Rafferty пишет:
> >
> > >> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler:
> thread
> > >> main exiting due to uncaught exception
> > >> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
> > >> java.lang.ClassCastException: com.xxx.phone.MyService$1
> > >> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791): at
> > >> com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)
> >
> > >> So it doesn't like the cast from binder to Service?
> >
> > >> How can I fix that do you know? What am I missing from the example?
> >
> > >> --
> > >> Kostya Vasilyev -- WiFi Manager + pretty widget --
> http://kmansoft.wordpress.com
> >
> > >>  --
> > >> 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 cr...@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
>

-- 
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: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
Kostya,

I do create a new Task as follows everytime:

new SelectRingtoneTask().execute();

But I had to use Looper.prepare(); to get it to work in my Service, this
could be causing an issue?

Is there a proper way to use a AsyncTask in a Service without needing to
call Looper.prepare();?

2010/9/13 Kostya Vasilyev 

>  Donal,
>
> It sort of seems like you reuse the same task over and over.
>
> What happens if you create a new task each time you need to perform the
> asynchronous operation?
>
> -- Kostya
>
> 13.09.2010 17:44, Donal Rafferty пишет:
>
> Kostya,
>
> Thanks, that conversation can be seen here:
>
>
> http://groups.google.com/group/android-developers/browse_thread/thread/07ea01892ee7a5f4/9f71428217c2cd44
>
> However the condition is in the cancel code, which I no longer use as I am
> running the code in a Service so I have no need to cancel it.
>
> 2010/9/13 Kostya Vasilyev 
>
>>  Donal,
>>
>> Search the list: there was a post within the last month (I think) from
>> Romain Guy about some kind of thread race issue in AsyncTask having been
>> fixed in Froyo (or was it post-Froyo?) - anyway, it's somewhere in the
>> archives.
>>
>> -- Kostya
>>
>> 13.09.2010 16:07, Donal Rafferty пишет:
>>
>> Sorry I meant only the preExecute is run
>>
>> On Mon, Sep 13, 2010 at 1:05 PM, Donal Rafferty wrote:
>>
>>> I have managed to implement the Task in my Service now but the original
>>> problem still remains.
>>>
>>> I dont cancel the Task at all in my service, I simply play the ringtone
>>> in the postExecute method of the Asynctask if a flag is true, if its not I
>>> dont.
>>>
>>> But I get the same issue, after a couple of runs the AsyncTask simply
>>> stops getting to the doInBackground method, only the postExecute method is
>>> run.
>>>
>>> Its very strange and really annoying me now.
>>>
>>> Is there any reason why an AsyncTask would behave like this without
>>> cancel being used?
>>>
>>>
>>> On Mon, Sep 13, 2010 at 10:58 AM, Donal Rafferty wrote:
>>>
>>>> Monday morning coding! :)
>>>>
>>>> I return my aidl definition in my service's onBind:
>>>>
>>>> @Override
>>>> public IBinder onBind(Intent arg0) {
>>>> Log.d("XXX", "Status: onBind Called");
>>>> return myServiceStub;
>>>> }
>>>>
>>>> IBinder myServiceStub = new IMyService.Stub(){
>>>>
>>>>  //aidl methods
>>>>
>>>> };
>>>>
>>>> And use this to call methods from my Activity, so I would need to be
>>>> able to import android.media.Ringtone in my aidl definition but I cant.
>>>>
>>>> So I'm still stuck with it not working :(
>>>>
>>>>
>>>> On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev 
>>>> wrote:
>>>>
>>>>>  Donal,
>>>>>
>>>>> No, a service is a service, and a binder is a binder.
>>>>>
>>>>> The binder you get in the callback is the binder returned by the
>>>>> service's onBind.
>>>>>
>>>>> This example:
>>>>>
>>>>>
>>>>> http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html
>>>>>
>>>>> has a binder implementation that returns a reference to its service, so
>>>>> you can do this
>>>>>
>>>>> public void onServiceConnected(ComponentName className,
>>>>>  IBinder binder) {
>>>>>
>>>>>  LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
>>>>> *LocalService service = binder.getService();*
>>>>> }
>>>>>
>>>>> This example has one flaw: it leaks a service reference (since
>>>>> LocalBinder is a non-static inner class of LocalService). Using a static
>>>>> inner or a top-level class for LocalBinder, fixes that (AFAIK).
>>>>>
>>>>> -- Kostya
>>>>>
>>>>> 13.09.2010 13:16, Donal Rafferty пишет:
>>>>>
>>>>> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler:
>>>>> thread main exiting due to uncaught exception
>>>>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
>>>>&g

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
Kostya,

Thanks, that conversation can be seen here:

http://groups.google.com/group/android-developers/browse_thread/thread/07ea01892ee7a5f4/9f71428217c2cd44

However the condition is in the cancel code, which I no longer use as I am
running the code in a Service so I have no need to cancel it.

2010/9/13 Kostya Vasilyev 

>  Donal,
>
> Search the list: there was a post within the last month (I think) from
> Romain Guy about some kind of thread race issue in AsyncTask having been
> fixed in Froyo (or was it post-Froyo?) - anyway, it's somewhere in the
> archives.
>
> -- Kostya
>
> 13.09.2010 16:07, Donal Rafferty пишет:
>
> Sorry I meant only the preExecute is run
>
> On Mon, Sep 13, 2010 at 1:05 PM, Donal Rafferty  wrote:
>
>> I have managed to implement the Task in my Service now but the original
>> problem still remains.
>>
>> I dont cancel the Task at all in my service, I simply play the ringtone in
>> the postExecute method of the Asynctask if a flag is true, if its not I
>> dont.
>>
>> But I get the same issue, after a couple of runs the AsyncTask simply
>> stops getting to the doInBackground method, only the postExecute method is
>> run.
>>
>> Its very strange and really annoying me now.
>>
>> Is there any reason why an AsyncTask would behave like this without cancel
>> being used?
>>
>>
>> On Mon, Sep 13, 2010 at 10:58 AM, Donal Rafferty wrote:
>>
>>> Monday morning coding! :)
>>>
>>> I return my aidl definition in my service's onBind:
>>>
>>> @Override
>>> public IBinder onBind(Intent arg0) {
>>> Log.d("XXX", "Status: onBind Called");
>>> return myServiceStub;
>>> }
>>>
>>> IBinder myServiceStub = new IMyService.Stub(){
>>>
>>>  //aidl methods
>>>
>>> };
>>>
>>> And use this to call methods from my Activity, so I would need to be able
>>> to import android.media.Ringtone in my aidl definition but I cant.
>>>
>>> So I'm still stuck with it not working :(
>>>
>>>
>>> On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev wrote:
>>>
>>>>  Donal,
>>>>
>>>> No, a service is a service, and a binder is a binder.
>>>>
>>>> The binder you get in the callback is the binder returned by the
>>>> service's onBind.
>>>>
>>>> This example:
>>>>
>>>>
>>>> http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html
>>>>
>>>> has a binder implementation that returns a reference to its service, so
>>>> you can do this
>>>>
>>>> public void onServiceConnected(ComponentName className,
>>>>  IBinder binder) {
>>>>
>>>>  LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
>>>> *LocalService service = binder.getService();*
>>>> }
>>>>
>>>> This example has one flaw: it leaks a service reference (since
>>>> LocalBinder is a non-static inner class of LocalService). Using a static
>>>> inner or a top-level class for LocalBinder, fixes that (AFAIK).
>>>>
>>>> -- Kostya
>>>>
>>>> 13.09.2010 13:16, Donal Rafferty пишет:
>>>>
>>>> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler:
>>>> thread main exiting due to uncaught exception
>>>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
>>>> java.lang.ClassCastException: com.xxx.phone.MyService$1
>>>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791): at
>>>> com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)
>>>>
>>>> So it doesn't like the cast from binder to Service?
>>>>
>>>> How can I fix that do you know? What am I missing from the example?
>>>>
>>>>
>>>>
>>>>  --
>>>> Kostya Vasilyev -- WiFi Manager + pretty widget -- 
>>>> http://kmansoft.wordpress.com
>>>>
>>>>  --
>>>>  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
>&g

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
Sorry I meant only the preExecute is run

On Mon, Sep 13, 2010 at 1:05 PM, Donal Rafferty  wrote:

> I have managed to implement the Task in my Service now but the original
> problem still remains.
>
> I dont cancel the Task at all in my service, I simply play the ringtone in
> the postExecute method of the Asynctask if a flag is true, if its not I
> dont.
>
> But I get the same issue, after a couple of runs the AsyncTask simply stops
> getting to the doInBackground method, only the postExecute method is run.
>
> Its very strange and really annoying me now.
>
> Is there any reason why an AsyncTask would behave like this without cancel
> being used?
>
>
> On Mon, Sep 13, 2010 at 10:58 AM, Donal Rafferty wrote:
>
>> Monday morning coding! :)
>>
>> I return my aidl definition in my service's onBind:
>>
>> @Override
>> public IBinder onBind(Intent arg0) {
>> Log.d("XXX", "Status: onBind Called");
>> return myServiceStub;
>> }
>>
>> IBinder myServiceStub = new IMyService.Stub(){
>>
>>  //aidl methods
>>
>> };
>>
>> And use this to call methods from my Activity, so I would need to be able
>> to import android.media.Ringtone in my aidl definition but I cant.
>>
>> So I'm still stuck with it not working :(
>>
>>
>> On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev wrote:
>>
>>>  Donal,
>>>
>>> No, a service is a service, and a binder is a binder.
>>>
>>> The binder you get in the callback is the binder returned by the
>>> service's onBind.
>>>
>>> This example:
>>>
>>>
>>> http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html
>>>
>>> has a binder implementation that returns a reference to its service, so
>>> you can do this
>>>
>>> public void onServiceConnected(ComponentName className,
>>>  IBinder binder) {
>>>
>>> LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
>>> *LocalService service = binder.getService();*
>>> }
>>>
>>> This example has one flaw: it leaks a service reference (since
>>> LocalBinder is a non-static inner class of LocalService). Using a static
>>> inner or a top-level class for LocalBinder, fixes that (AFAIK).
>>>
>>> -- Kostya
>>>
>>> 13.09.2010 13:16, Donal Rafferty пишет:
>>>
>>> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler: thread
>>> main exiting due to uncaught exception
>>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
>>> java.lang.ClassCastException: com.xxx.phone.MyService$1
>>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791): at
>>> com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)
>>>
>>> So it doesn't like the cast from binder to Service?
>>>
>>> How can I fix that do you know? What am I missing from the example?
>>>
>>>
>>>
>>> --
>>> Kostya Vasilyev -- WiFi Manager + pretty widget -- 
>>> http://kmansoft.wordpress.com
>>>
>>>  --
>>> 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

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
I have managed to implement the Task in my Service now but the original
problem still remains.

I dont cancel the Task at all in my service, I simply play the ringtone in
the postExecute method of the Asynctask if a flag is true, if its not I
dont.

But I get the same issue, after a couple of runs the AsyncTask simply stops
getting to the doInBackground method, only the postExecute method is run.

Its very strange and really annoying me now.

Is there any reason why an AsyncTask would behave like this without cancel
being used?

On Mon, Sep 13, 2010 at 10:58 AM, Donal Rafferty  wrote:

> Monday morning coding! :)
>
> I return my aidl definition in my service's onBind:
>
> @Override
> public IBinder onBind(Intent arg0) {
> Log.d("XXX", "Status: onBind Called");
> return myServiceStub;
> }
>
> IBinder myServiceStub = new IMyService.Stub(){
>
>  //aidl methods
>
> };
>
> And use this to call methods from my Activity, so I would need to be able
> to import android.media.Ringtone in my aidl definition but I cant.
>
> So I'm still stuck with it not working :(
>
>
> On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev wrote:
>
>>  Donal,
>>
>> No, a service is a service, and a binder is a binder.
>>
>> The binder you get in the callback is the binder returned by the service's
>> onBind.
>>
>> This example:
>>
>>
>> http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html
>>
>> has a binder implementation that returns a reference to its service, so
>> you can do this
>>
>> public void onServiceConnected(ComponentName className,
>>  IBinder binder) {
>>
>> LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
>> *LocalService service = binder.getService();*
>> }
>>
>> This example has one flaw: it leaks a service reference (since LocalBinder
>> is a non-static inner class of LocalService). Using a static inner or a
>> top-level class for LocalBinder, fixes that (AFAIK).
>>
>> -- Kostya
>>
>> 13.09.2010 13:16, Donal Rafferty пишет:
>>
>> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler: thread
>> main exiting due to uncaught exception
>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
>> java.lang.ClassCastException: com.xxx.phone.MyService$1
>> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791): at
>> com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)
>>
>> So it doesn't like the cast from binder to Service?
>>
>> How can I fix that do you know? What am I missing from the example?
>>
>>
>>
>> --
>> Kostya Vasilyev -- WiFi Manager + pretty widget -- 
>> http://kmansoft.wordpress.com
>>
>>  --
>> 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

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
Monday morning coding! :)

I return my aidl definition in my service's onBind:

@Override
public IBinder onBind(Intent arg0) {
Log.d("XXX", "Status: onBind Called");
return myServiceStub;
}

IBinder myServiceStub = new IMyService.Stub(){

 //aidl methods

};

And use this to call methods from my Activity, so I would need to be able to
import android.media.Ringtone in my aidl definition but I cant.

So I'm still stuck with it not working :(

On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev wrote:

>  Donal,
>
> No, a service is a service, and a binder is a binder.
>
> The binder you get in the callback is the binder returned by the service's
> onBind.
>
> This example:
>
>
> http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html
>
> has a binder implementation that returns a reference to its service, so you
> can do this
>
> public void onServiceConnected(ComponentName className,
>  IBinder binder) {
>
> LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
> *LocalService service = binder.getService();*
> }
>
> This example has one flaw: it leaks a service reference (since LocalBinder
> is a non-static inner class of LocalService). Using a static inner or a
> top-level class for LocalBinder, fixes that (AFAIK).
>
> -- Kostya
>
> 13.09.2010 13:16, Donal Rafferty пишет:
>
> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler: thread
> main exiting due to uncaught exception
> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
> java.lang.ClassCastException: com.xxx.phone.MyService$1
> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791): at
> com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)
>
> So it doesn't like the cast from binder to Service?
>
> How can I fix that do you know? What am I missing from the example?
>
>
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget -- 
> http://kmansoft.wordpress.com
>
>  --
> 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

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-13 Thread Donal Rafferty
Thanks for that! Excellent code.

But I have a problem!

When I try to do the following:

 private MyService service=null;

 private ServiceConnection svcConn=new ServiceConnection() {
 public void onServiceConnected(ComponentName className,
 IBinder binder) {
 service=(MyService)binder;

 try {
 service.getRingTone();
 }
 catch (Throwable t) {
 Log.e("Patchy", "Exception in call to registerAccount()", t);
 //goBlooey(t);
 }
 }

 public void onServiceDisconnected(ComponentName className) {
 service=null;
 }
 };


bindService(new Intent(this, MyService.class), svcConn,
BIND_AUTO_CREATE);

I get an uncaught exception error on this line:

service=(MyService)binder;

09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler: thread
main exiting due to uncaught exception
09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
java.lang.ClassCastException: com.xxx.phone.MyService$1
09-13 10:06:53.676: ERROR/AndroidRuntime(18791): at
com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)

So it doesn't like the cast from binder to Service?

How can I fix that do you know? What am I missing from the example?




On Sat, Sep 11, 2010 at 8:22 AM, Federico Paolinelli wrote:

> You need to use aidl if you want to call another process. But if you
> want to interact with the service from activities of the same
> application,
> you can call the methods directly from the activity.
>
> Check for example this sample code from Mark's tutorial:
> http://github.com/commonsguy/cw-andtutorials/tree/master/18-LocalService/
>
>
>
> On 10 Set, 19:32, Donal Rafferty  wrote:
> > As in the following piece of code...? :
> >
> > bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE);
> >
> > I do that but I think I do require the aidl to be able to call methods
> from
> > the service?
> >
> > On Fri, Sep 10, 2010 at 6:17 PM, Federico Paolinelli  >wrote:
> >
> > > In any case, I meant binding the activity to the service using
> > > bindService method without passing from the aidl.
> > > In this way you will get direct access to the methods of the service
> > > directly from the activity. In this way, I suppose you can pass the
> > > service an interface to get called when your asynctask finished its
> > > job.
> >
> > > Try to google for service binding examples.
> >
> > > Hope this helps (and I hope I am not saying bullshit as well :-) )
> >
> > >Federico
> >
> > > On Fri, Sep 10, 2010 at 7:03 PM, Donal Rafferty 
> wrote:
> > > > No luck :(
> >
> > > > ---
> >
> > > > package com.xxx.phone.ui;
> >
> > > > import android.media.Ringtone;
> >
> > > > interface ICallDialogActivity{
> > > > void sendRingTone(in RingTone aRingTone);
> > > > }
> >
> > > > ---
> >
> > > > I get the red x beside the import and "coundn't find import for class
> > > > android.media.Ringtone;"
> >
> > > > On Fri, Sep 10, 2010 at 5:45 PM, Mark Murphy <
> mmur...@commonsware.com>
> > > > wrote:
> >
> > > >> On Fri, Sep 10, 2010 at 12:28 PM, Donal Rafferty  >
> > > >> wrote:
> > > >> > Is that possible?
> >
> > > >> > I have a bind between my Service and the Activity at the minute
> but
> > > when
> > > >> > I
> > > >> > try to change to aidl file to allow me pass the RingTone object it
> > > wont
> > > >> > compile for me, saying RingTone and com.android.RingTone cannot be
> > > >> > resolved/found
> >
> > > >> Try android.media.Ringtone.
> >
> > > >> --
> > > >> Mark Murphy (a Commons Guy)
> > > >>http://commonsware.com|http://github.com/commonsguy
> > > >>http://commonsware.com/blog|http://twitter.com/commonsguy<http://commonsware.com/blog%7Chttp://twitter.com/commonsguy>
> >
> > > >> Android Training in London:
> http://skillsmatter.com/go/os-mobile-server
> >
> > > >> --
> > > >> 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 unsub

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-10 Thread Donal Rafferty
As in the following piece of code...? :

bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE);

I do that but I think I do require the aidl to be able to call methods from
the service?

On Fri, Sep 10, 2010 at 6:17 PM, Federico Paolinelli wrote:

> In any case, I meant binding the activity to the service using
> bindService method without passing from the aidl.
> In this way you will get direct access to the methods of the service
> directly from the activity. In this way, I suppose you can pass the
> service an interface to get called when your asynctask finished its
> job.
>
> Try to google for service binding examples.
>
> Hope this helps (and I hope I am not saying bullshit as well :-) )
>
>Federico
>
> On Fri, Sep 10, 2010 at 7:03 PM, Donal Rafferty  wrote:
> > No luck :(
> >
> > ---
> >
> > package com.xxx.phone.ui;
> >
> > import android.media.Ringtone;
> >
> > interface ICallDialogActivity{
> > void sendRingTone(in RingTone aRingTone);
> > }
> >
> > ---
> >
> > I get the red x beside the import and "coundn't find import for class
> > android.media.Ringtone;"
> >
> > On Fri, Sep 10, 2010 at 5:45 PM, Mark Murphy 
> > wrote:
> >>
> >> On Fri, Sep 10, 2010 at 12:28 PM, Donal Rafferty 
> >> wrote:
> >> > Is that possible?
> >> >
> >> > I have a bind between my Service and the Activity at the minute but
> when
> >> > I
> >> > try to change to aidl file to allow me pass the RingTone object it
> wont
> >> > compile for me, saying RingTone and com.android.RingTone cannot be
> >> > resolved/found
> >>
> >> Try android.media.Ringtone.
> >>
> >> --
> >> Mark Murphy (a Commons Guy)
> >> http://commonsware.com | http://github.com/commonsguy
> >> http://commonsware.com/blog | http://twitter.com/commonsguy
> >>
> >> Android Training in London: http://skillsmatter.com/go/os-mobile-server
> >>
> >> --
> >> 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
>
>
>
> --
> 
> Federico
>
> --
> 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

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-10 Thread Donal Rafferty
No luck :(

---

package com.xxx.phone.ui;

import android.media.Ringtone;

interface ICallDialogActivity{
void sendRingTone(in RingTone aRingTone);
}

---

I get the red x beside the import and "coundn't find import for class
android.media.Ringtone;"

On Fri, Sep 10, 2010 at 5:45 PM, Mark Murphy wrote:

> On Fri, Sep 10, 2010 at 12:28 PM, Donal Rafferty 
> wrote:
> > Is that possible?
> >
> > I have a bind between my Service and the Activity at the minute but when
> I
> > try to change to aidl file to allow me pass the RingTone object it wont
> > compile for me, saying RingTone and com.android.RingTone cannot be
> > resolved/found
>
> Try android.media.Ringtone.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in London: http://skillsmatter.com/go/os-mobile-server
>
> --
> 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

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-10 Thread Donal Rafferty
Is that possible?

I have a bind between my Service and the Activity at the minute but when I
try to change to aidl file to allow me pass the RingTone object it wont
compile for me, saying RingTone and com.android.RingTone cannot be
resolved/found

On Fri, Sep 10, 2010 at 1:34 PM, Federico Paolinelli wrote:

> One way I would try is to bind your activity to the service and give
> the service a callback to be called when you asynctask has finished
> its dirty job. (I've never done this, but it may work).
> You can provide your ringtone object as argument of the callback.
>
>
>
> On 10 Set, 13:38, Donal Rafferty  wrote:
> > Excellent idea Federico, However my AsyncTask fetches a RingTone object
> > (com.android.RingTone) and I have no way of passing this object from my
> > Service to my Activity?
> >
> > On Fri, Sep 10, 2010 at 11:36 AM, Federico Paolinelli <
> fedep...@gmail.com>wrote:
> >
> > > You could probably move the async task to a service, and broadcast all
> > > your stuff when you finish.
> > > If your activity listens for the broadcast, it won't matter if the
> > > activity itself started the service, or if it was started by another
> > > activity (of the same kind).
> >
> > > Federico
> >
> > > On Sep 10, 12:14 pm, Donal Rafferty  wrote:
> > > > Thanks for that Shawn, but I'm looking for a solution that doesn't
> > > involve
> > > > external libraries.
> >
> > > > On Fri, Sep 10, 2010 at 10:45 AM, Shawn Brown <
> > > big.coffee.lo...@gmail.com>wrote:
> >
> > > > > > Has anybody got any idea why this would be happening?
> >
> > > > > Well...  from
> > > > >
> http://brainflush.wordpress.com/2009/11/16/introducing-droid-fu-for-a.
> > > ..
> >
> > > > > So the basic idea is: launch an AsyncTask making your service call,
> > > > > show a nifty progress dialog while the task thread is running, and
> > > > > have the task’s result be posted back to your activity once it
> > > > > completes. Cool, but what if the user decides to rotate the screen
> > > > > while your task is running? Or a phone call comes in, interrupting
> > > > > your app, and Android decides to kill it? Both these actions will
> > > > > effectively terminateyour activity, and recreate it when resuming
> > > > > (yes, a screen rotation kills your activity, very clever, isn’t
> it?).
> > > > > Unfortunately, any AsyncTask that was still running now holds a
> stale
> > > > > reference to your activity, because the restarted activity will be
> an
> > > > > entirely different object in memory (and it will go through
> > > > > onCreate(), as if the activity had started for the first time). I’m
> > > > > not entirely sure whether AsyncTask will actually post back the
> data
> > > > > to the old activity object (if it was a weak reference, it may
> already
> > > > > have been garbage collected), but in any case, your “new” activity
> > > > > will never see it, because it’s a different instance.
> >
> > > > > Now, one could argue: well, just do all the work again, like,
> re-send
> > > > > the request or whatever job was running. Yes, you could do that.
> But
> > > > > that’s wasteful and, really, makes you feel stupid, no? Plus, if
> the
> > > > > user triggers a web service request, then flips the screen, decides
> > > > > that this wasn’t helpful, and flips it back, then your request is
> > > > > being sent 3 times in parallel. Is that what you want? Probably
> not.
> >
> > > > > BetterAsyncTask to the Rescue
> >
> > > > > Thanks to Droid-Fu, there’s a solution to this: BetterAsyncTask!
> (I’m
> > > > > a lazy person, and I couldn’t come up with a better name). It
> behaves
> > > > > exactly like AsyncTask (in fact, it is an AsyncTask), but it does
> some
> > > > > extra work for you: first and foremost, it keeps track of the
> active
> > > > > instance of the context that launched it, and if that instance
> should
> > > > > change, it will post the data back to the new instance. In other
> > > > > words, you can dispatch your task, flip the screen back and forth
> > > > > mentally, and BetterAsyncTask will still post the task’s result
> back
> > > > > to whatever activity instance is alive at the ti

Re: [android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-10 Thread Donal Rafferty
Excellent idea Federico, However my AsyncTask fetches a RingTone object
(com.android.RingTone) and I have no way of passing this object from my
Service to my Activity?


On Fri, Sep 10, 2010 at 11:36 AM, Federico Paolinelli wrote:

> You could probably move the async task to a service, and broadcast all
> your stuff when you finish.
> If your activity listens for the broadcast, it won't matter if the
> activity itself started the service, or if it was started by another
> activity (of the same kind).
>
> Federico
>
> On Sep 10, 12:14 pm, Donal Rafferty  wrote:
> > Thanks for that Shawn, but I'm looking for a solution that doesn't
> involve
> > external libraries.
> >
> > On Fri, Sep 10, 2010 at 10:45 AM, Shawn Brown <
> big.coffee.lo...@gmail.com>wrote:
> >
> > > > Has anybody got any idea why this would be happening?
> >
> > > Well...  from
> > >http://brainflush.wordpress.com/2009/11/16/introducing-droid-fu-for-a.
> ..
> >
> > > So the basic idea is: launch an AsyncTask making your service call,
> > > show a nifty progress dialog while the task thread is running, and
> > > have the task’s result be posted back to your activity once it
> > > completes. Cool, but what if the user decides to rotate the screen
> > > while your task is running? Or a phone call comes in, interrupting
> > > your app, and Android decides to kill it? Both these actions will
> > > effectively terminateyour activity, and recreate it when resuming
> > > (yes, a screen rotation kills your activity, very clever, isn’t it?).
> > > Unfortunately, any AsyncTask that was still running now holds a stale
> > > reference to your activity, because the restarted activity will be an
> > > entirely different object in memory (and it will go through
> > > onCreate(), as if the activity had started for the first time). I’m
> > > not entirely sure whether AsyncTask will actually post back the data
> > > to the old activity object (if it was a weak reference, it may already
> > > have been garbage collected), but in any case, your “new” activity
> > > will never see it, because it’s a different instance.
> >
> > > Now, one could argue: well, just do all the work again, like, re-send
> > > the request or whatever job was running. Yes, you could do that. But
> > > that’s wasteful and, really, makes you feel stupid, no? Plus, if the
> > > user triggers a web service request, then flips the screen, decides
> > > that this wasn’t helpful, and flips it back, then your request is
> > > being sent 3 times in parallel. Is that what you want? Probably not.
> >
> > > BetterAsyncTask to the Rescue
> >
> > > Thanks to Droid-Fu, there’s a solution to this: BetterAsyncTask! (I’m
> > > a lazy person, and I couldn’t come up with a better name). It behaves
> > > exactly like AsyncTask (in fact, it is an AsyncTask), but it does some
> > > extra work for you: first and foremost, it keeps track of the active
> > > instance of the context that launched it, and if that instance should
> > > change, it will post the data back to the new instance. In other
> > > words, you can dispatch your task, flip the screen back and forth
> > > mentally, and BetterAsyncTask will still post the task’s result back
> > > to whatever activity instance is alive at the time it finishes. In
> > > other words, the task is only ever run once, regardless whether the
> > > context in which it was launched died while it was running or not.
> >
> > >http://github.com/kaeppler/droid-fu
> >
> > > --
> > > 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
>

-- 
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] AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-10 Thread Donal Rafferty
Thanks for that Shawn, but I'm looking for a solution that doesn't involve
external libraries.

On Fri, Sep 10, 2010 at 10:45 AM, Shawn Brown wrote:

> > Has anybody got any idea why this would be happening?
>
> Well...  from
> http://brainflush.wordpress.com/2009/11/16/introducing-droid-fu-for-android-betteractivity-betterservice-and-betterasynctask/
>
> So the basic idea is: launch an AsyncTask making your service call,
> show a nifty progress dialog while the task thread is running, and
> have the task’s result be posted back to your activity once it
> completes. Cool, but what if the user decides to rotate the screen
> while your task is running? Or a phone call comes in, interrupting
> your app, and Android decides to kill it? Both these actions will
> effectively terminateyour activity, and recreate it when resuming
> (yes, a screen rotation kills your activity, very clever, isn’t it?).
> Unfortunately, any AsyncTask that was still running now holds a stale
> reference to your activity, because the restarted activity will be an
> entirely different object in memory (and it will go through
> onCreate(), as if the activity had started for the first time). I’m
> not entirely sure whether AsyncTask will actually post back the data
> to the old activity object (if it was a weak reference, it may already
> have been garbage collected), but in any case, your “new” activity
> will never see it, because it’s a different instance.
>
> Now, one could argue: well, just do all the work again, like, re-send
> the request or whatever job was running. Yes, you could do that. But
> that’s wasteful and, really, makes you feel stupid, no? Plus, if the
> user triggers a web service request, then flips the screen, decides
> that this wasn’t helpful, and flips it back, then your request is
> being sent 3 times in parallel. Is that what you want? Probably not.
>
> BetterAsyncTask to the Rescue
>
> Thanks to Droid-Fu, there’s a solution to this: BetterAsyncTask! (I’m
> a lazy person, and I couldn’t come up with a better name). It behaves
> exactly like AsyncTask (in fact, it is an AsyncTask), but it does some
> extra work for you: first and foremost, it keeps track of the active
> instance of the context that launched it, and if that instance should
> change, it will post the data back to the new instance. In other
> words, you can dispatch your task, flip the screen back and forth
> mentally, and BetterAsyncTask will still post the task’s result back
> to whatever activity instance is alive at the time it finishes. In
> other words, the task is only ever run once, regardless whether the
> context in which it was launched died while it was running or not.
>
> http://github.com/kaeppler/droid-fu
>
> --
> 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

Re: [android-developers] onBackPressed() not working

2010-08-25 Thread Donal Rafferty
Thanks Dianne,

Adding this line solved my problem

 return super.onKeyDown(keyCode, event);

And I have changed the code to use moveTaskToBack(true); instead.

Thanks

On Tue, Aug 24, 2010 at 6:02 PM, Dianne Hackborn wrote:

> Starting an activity in onBackPressed is...  questionable.  You really
> should use moveTaskToBack().
>
> Sorry I know this doesn't answer your actual question...  I'll look and see
> if it is working on my devices.
>
> On Tue, Aug 24, 2010 at 8:56 AM, draf...@gmail.com wrote:
>
>> I have an application building against Android 2.1 and I want to
>> override the back button.
>>
>> I have followed the example here:
>>
>> http://android-developers.blogspot.com/2009_12_01_archive.html
>>
>> And my code is as follows:
>>
>> ---
>>
>>@Override
>>public boolean onKeyDown(int keyCode, KeyEvent event)  {
>>if (Integer.parseInt(android.os.Build.VERSION.SDK) < 5
>>&& keyCode == KeyEvent.KEYCODE_BACK
>>&& event.getRepeatCount() == 0) {
>>Log.d("CDA", "onKeyDown Called");
>>onBackPressed();
>>}
>>
>>return true;
>>}
>>
>>@Override
>>public void onBackPressed() {
>>Log.d("CDA", "onBackPressed Called");
>>Intent setIntent = new Intent(Intent.ACTION_MAIN);
>>setIntent.addCategory(Intent.CATEGORY_HOME);
>>setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>>startActivity(setIntent);
>>
>>return;
>>}
>>
>> ---
>>
>> It works on pre 2.x devices but doesn't work on a Hero with 2.1
>> update-1 and a Nexus One with 2.2.
>>
>> Is there somwthing I am missing from the example? Or can anyone point
>> out why it isn't working?
>>
>> I dont even get the button pressed in the logcat.
>>
>> --
>>
>> 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
>>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
>  --
> 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

Re: [android-developers] How to code ContactsContract so that it runs in 2.2 and doesn't crash 1.5?

2010-07-28 Thread Donal Rafferty
Actually I have found the solution to the above problem, well kind of, it
turns out the problem is elsewhere,

I am trying to find the Id of a contact via the phone number and try as
follows but I get an ID of 2324 when it should be 404, anyone any ideas why?

 static {
 int sdk=new Integer(Build.VERSION.SDK).intValue();

 if (sdk>=5) {
 try {
 Class
clazz=Class.forName("android.provider.ContactsContract$CommonDataKinds$Phone");

 CONTENT_URI=(Uri)clazz.getField("CONTENT_URI").get(clazz);
 NAME_URI=(String) clazz.getField("DISPLAY_NAME").get(clazz);
 ID_URI=(String) clazz.getField("_ID").get(clazz);

 NUMBER_URI=(String)clazz.getField("NUMBER").get(clazz);

 }
 catch (Throwable t) {
 Log.e("reflection", "Exception when determining CONTENT_URI", t);
 }
 }
 else {
 CONTENT_URI=Contacts.People.CONTENT_URI;

 NAME_URI=People.NAME;
 ID_URI=People._ID;

 NUMBER_URI=People.NUMBER;

 }
 }




public int getContactId(String phoneNumber){

 String [] requestedColumns = {
 NAME_URI,
 ID_URI
 };

 Cursor contacts = context.getContentResolver().query(
 CONTENT_URI,
 requestedColumns,
 NUMBER_URI + "='" + phoneNumber + "'",
 null, null);


 Log.d("GETDETAILS", "Count = " + contacts.getCount());
 if(contacts.getCount() > 0){
 int nameIdx = contacts.getColumnIndex(NAME_URI);
 int idIdx = contacts.getColumnIndex(ID_URI);

 contacts.moveToFirst();
 Log.d("DETAILS", "Name : " + contacts.getString(nameIdx));
 Log.d("DETAILS", "Type : " + contacts.getString(idIdx));
 return contacts.getInt(idIdx);
 }
 else

 return 0;

 }

On Wed, Jul 28, 2010 at 10:07 AM, Donal Rafferty  wrote:

> Thanks Kostya,
>
> I have grasped that now and have it working in one part of my application.
>
> I have another problem now though.
>
> I have this in code:
>
> Uri contactUri = ContentUris.withAppendedId
> (Contacts.People.CONTENT_URI, contactId);
>
>
> Intent intent = new Intent(Intent.ACTION_VIEW, contactUri);
> startActivity(intent);
>
> This launchs the contacts application and displays the contact according to
> the ID supplied, this works in all Android versions except 2.2 (API level 8)
> and I cant find the equivalant code for 2.2.
>
> I have tried ContactsContract.PhoneLookup, ContactsContract.Contact,
> ContactsContract.CommonDataKinds but none of them seem to let me launch the
> contacts application and dispaly a contacts info according to a supplied ID.
>
> Can anyone help with this?
>
> On Tue, Jul 27, 2010 at 4:27 PM, Kostya Vasilyev wrote:
>
>> Hi,
>>
>> The offending line is this:
>>
>> ContactsContract.Contacts
>>
>> Even though you're not referencing this nested member on the execution
>> path, the Java VM still tries to resolve all external references made by
>> your code. This is done when your code is first loaded into memory for
>> execution, before it is run. At this point, the external reference fails
>> (since you are on Android 1.5), and your code is not able to load and
>> execute.
>>
>> The solution is to use Java Reflection feature to not make any
>> compile-time references to missing classes / members, but rather check at
>> runtime whether they exist. This way, there are no compile-time references
>> to stuff that only exists in later API levels, and your code can gracefully
>> fall back to earlier APIs at runtime.
>>
>> The key is what references your code makes at compile time, and, as a
>> consequence, when your class is loaded into memory.
>>
>> http://java.sun.com/developer/technicalArticles/ALT/Reflection/
>>
>> That is the general solution.
>>
>> However, in this particular case, you could duplicate the URI string from
>>
>> ContactsContract.Contacts.CONTENT_URI
>>
>> to some string constant in your code. Just like this:
>>
>> class YourClass {
>>
>> private static final String ANDROID_1_X_CONTACTS_URI = People.CONTENT_URI;
>>
>> private static final String ANDROID_2_X_CONTACTS_URI = "content://> correct value here>";
>> }
>>
>> Then use the appropriate constant (one of the two) based on API level just
>> like you're trying to do now.
>>
>> -- Kostya
>>
>> 27.07.2010 18:10, draf...@gmail.com пишет:
>

Re: [android-developers] How to code ContactsContract so that it runs in 2.2 and doesn't crash 1.5?

2010-07-28 Thread Donal Rafferty
Thanks Kostya,

I have grasped that now and have it working in one part of my application.

I have another problem now though.

I have this in code:

Uri contactUri = ContentUris.withAppendedId
(Contacts.People.CONTENT_URI, contactId);

Intent intent = new Intent(Intent.ACTION_VIEW, contactUri);
startActivity(intent);

This launchs the contacts application and displays the contact according to
the ID supplied, this works in all Android versions except 2.2 (API level 8)
and I cant find the equivalant code for 2.2.

I have tried ContactsContract.PhoneLookup, ContactsContract.Contact,
ContactsContract.CommonDataKinds but none of them seem to let me launch the
contacts application and dispaly a contacts info according to a supplied ID.

Can anyone help with this?

On Tue, Jul 27, 2010 at 4:27 PM, Kostya Vasilyev  wrote:

> Hi,
>
> The offending line is this:
>
> ContactsContract.Contacts
>
> Even though you're not referencing this nested member on the execution
> path, the Java VM still tries to resolve all external references made by
> your code. This is done when your code is first loaded into memory for
> execution, before it is run. At this point, the external reference fails
> (since you are on Android 1.5), and your code is not able to load and
> execute.
>
> The solution is to use Java Reflection feature to not make any compile-time
> references to missing classes / members, but rather check at runtime whether
> they exist. This way, there are no compile-time references to stuff that
> only exists in later API levels, and your code can gracefully fall back to
> earlier APIs at runtime.
>
> The key is what references your code makes at compile time, and, as a
> consequence, when your class is loaded into memory.
>
> http://java.sun.com/developer/technicalArticles/ALT/Reflection/
>
> That is the general solution.
>
> However, in this particular case, you could duplicate the URI string from
>
> ContactsContract.Contacts.CONTENT_URI
>
> to some string constant in your code. Just like this:
>
> class YourClass {
>
> private static final String ANDROID_1_X_CONTACTS_URI = People.CONTENT_URI;
>
> private static final String ANDROID_2_X_CONTACTS_URI = "content:// correct value here>";
> }
>
> Then use the appropriate constant (one of the two) based on API level just
> like you're trying to do now.
>
> -- Kostya
>
> 27.07.2010 18:10, draf...@gmail.com пишет:
>
>  I have the following piece of code in my Android application that
>> looks up a contacts ID, I have just changed the target from 1.5 to 2.2
>> but with a min SDK of 3 (1.5) so that I can use the ContactsContract
>> Uri in 2.2 and the People Uri in 1.5.
>>
>> However the code leads to the following error when run on 1.5 devices:
>>
>> 07-27 15:02:53.382: WARN/dalvikvm(12656): VFY: unable to resolve
>> static field 25 (CONTENT_URI) in Landroid/provider/ContactsContract
>> $Contacts;
>>
>> ---
>>
>> > From google I have garnered that I need to use reflection in this case
>> to allow the application run on both versions of Android?
>>
>> I have seen example's of how to use reflection to use methods of
>> multiple/different versions but how can I use it in mycase where I
>> want to use the ContactsContract Uri?
>>
>> Here is my code:
>>
>> ---
>>
>>
>> findViewById(R.id.contactimage).setOnClickListener(new
>> OnClickListener() {
>>public void onClick(View v) {
>>
>>String sdk = android.os.Build.VERSION.SDK;
>>Uri contactUri;
>>Log.d("CDA", "Contact ID Button pressed = "
>> +
>> contactId);
>>if(sdk.equals("8")){
>>contactUri =
>> ContentUris.withAppendedId
>>
>>  (ContactsContract.Contacts.CONTENT_URI, contactId);
>>
>>Intent intent = new
>> Intent(Intent.ACTION_VIEW,
>> contactUri);
>>startActivity(intent);
>>
>>}
>>else{
>>contactUri = ContentUris.withAppendedId
>>(People.CONTENT_URI, contactId);
>>
>>Intent intent = new
>> Intent(Intent.ACTION_VIEW,
>> contactUri);
>>startActivity(intent);
>>}
>>
>>dispatchKeyEvent(new
>> KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.FLAG_SOFT_KEYBOARD));
>>dispatchKeyEvent(new
>> KeyEvent(KeyEvent.ACTION_UP,
>> KeyEvent.KEYCODE_BACK));
>>}
>>});
>>
>>
>>
>
>
> --
> Kostya Vasilev -- WiFi Manager + pretty widget --
> http://kmansoft.wordpress.com
>
>
> --
> 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@googl

[android-developers] Notification Error - contentIntent

2010-06-24 Thread Donal Rafferty
I have a service running that updates a notification in the notification bar
when it recieves a message saying it has to be changed.

However I get the following error sometimes when the notification is to be
updated

java.lang.IllegalArgumentException: contentIntent required

Here is my code:

Variable setup

---

int icon = R.drawable.notification;
CharSequence tickerText = "Test";
long when = System.currentTimeMillis();
PendingIntent contentIntent;

Notification notification = new Notification(icon, tickerText, when);

NotificationManager mNotificationManager;

---

NotificationManager Creation

---

String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager) getSystemService(ns);

---

Notification Creation

---


Intent notificationIntent = new Intent(this, TestsApp.class);
contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.flags |= Notification.FLAG_NO_CLEAR;
notification.icon = R.drawable.notification3;
notification.setLatestEventInfo(this, "Registering", "Test",
contentIntent);
mNotificationManager.notify(1, notification);

---

Update of Notification

---

notification.icon = R.drawable.notification2;
notification.setLatestEventInfo(getApplicationContext(),
"Registered", "Test", contentIntent);
mNotificationManager.notify(1, notification);

---

So something is happening my contentIntent somewhere along the line, would
that be correct?

It is declared at the top of my Service class as a member variable and is
not used anywhere else in the code apart from shown above, so where could it
be getting reset to null?

-- 
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] A clear, concise tutorial on PreferenceActivity & Preferences?

2010-06-01 Thread Donal Rafferty
Thanks Mark.

To access my preferences outside my PreferenceActivity in another Activity
or a Service can I use PreferenceManager.
getDefaultSharedPreferences() also?

In your code here:

http://github.com/commonsguy/cw-android/blob/master/Prefs/Dialogs/src/com/commonsware/android/prefdialogs/DialogsDemo.java

I see SharedPreferences prefs=PreferenceManager is used, is that correct?
Should I use it like that to retrieve my preferences eslewhere in my
application?

On Tue, Jun 1, 2010 at 4:26 PM, Mark Murphy  wrote:

> draf...@gmail.com wrote:
> > I was wondering can anyone direct me to a detailed Preferences
> > tutorial?
> >
> > Or provide me with a bit of help here?
> >
> > I have my preferences saved in preferences.xml as follows:
> >
> > http://schemas.android.com/apk/res/
> > android">
> > 
> >
> >  > android:key="edittext_block_attach_err"
> > android:title="@string/title_edittext_preference"
> > android:summary="@string/summary_edittext_preference"
> > android:dialogTitle="@string/
> > dialog_title_edittext_preference" />
> >
> > 
> >
> > 
> >
> > I then have a preference activity as follows:
> >
> > public class WlanSettings extends PreferenceActivity {
> >
> > SharedPreferences prefs;
> >
> >
> > @Override
> > protected void onCreate(Bundle savedInstanceState) {
> > super.onCreate(savedInstanceState);
> >
> > addPreferencesFromResource(R.xml.preferences);
> > prefs = this.getSharedPreferences("CiceroWlanSettings",
> > Activity.MODE_PRIVATE);
> >
> >
> > }
> >
> > This display's the EditTextPreference fine but how do I then set up a
> > default preference to be displayed in the dialog box that pops up with
> > an EditTextPreference?
>
> android:defaultValue in the XML.
>
> > And How do I save changes that occur in my preference activity to my
> > preferences?
>
> It happens automatically.
>
> I don't know what that prefs=this.getSharedPreferences() line is for.
> It's not needed, and it's probably reading the wrong file, anyway. Use
> PreferenceManager.getDefaultSharedPreferences() for work with the file
> that will be used by the PreferenceActivity.
>
> See:
>
> http://github.com/commonsguy/cw-android/tree/master/Prefs/Dialogs/
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 2.0 Available!
>
> --
> 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] Re: SendOrderedBroadcast Help

2010-05-31 Thread Donal Rafferty
**UPDATED CODE:**

---

sendOrderedBroadcast(i, null, domainBroadcast, null, Activity.RESULT_OK,
null, null);

---

class DomainBroadcast extends BroadcastReceiver{

@Override
public void onReceive(Context arg0, Intent intent) {
String action = intent.getAction();

if(GlobalData.PROPOSE_IN_DOMAIN_ROAM_INTENT.equals(action)){
Log.d("BROADCAST", "Returning broadcast");

Bundle b = intent.getExtras();
Log.d("BROADCAST", "Returning broadcast " +
b.getInt("com.testnetworks.INT_TEST"));
}
}

---

@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

if(GlobalData.PROPOSE_IN_DOMAIN_ROAM_INTENT.equals(action)){

Bundle b = intent.getExtras();
int testQCLevel = b.getInt("com.testnetworks.QCLEVEL");
switch(testQCLevel){
case 1:
Log.d("QCLevel ", "QCLevel = UNAVAILABLE");
break;
case 2:
Log.d("QCLevel ", "QCLevel = BELOWUSABILITY");
break;
case 3:
Log.d("QCLevel ", "QCLevel = VOICE");
break;
}

intent.putExtra("com.testnetworks.INT_TEST", 100);

  }

---


So according to the Doc's I should recieve 100 back in my DomainBroadcast
reciever but it always comes back as 0.

Can anyone see why?

On Mon, May 31, 2010 at 2:03 PM, draf...@gmail.com wrote:

>
>
> I am trying to use a sendOrderedBroadcast in my Android app.
>
> I want to be able to send the Intent from one of my applications to
> another and I then want to get data back from the Application that
> recieves the Intent, in this case a boolean true or false.
>
> Here is the current code:
>
>Intent i = new Intent();
>i.setAction(GlobalData.PROPOSE_IN_DOMAIN_ROAM_INTENT);
>i.putExtra("com.testnetworks.QCLEVEL",
> aProposedTheoreticalQoSLevel);
>sendOrderedBroadcast(i, null, null, null, Activity.RESULT_OK,
> null, null);
>
> Is this the correct way to achieve what I want?
>
> If so what do I use as the resultReceiver* parameter? (3rd parameter)
>
> And then how to I recieve data back from the Broadcast?
>
> I have done a quick google and not come up with any examples, any help
> or examples greatly appreciated.
>
> *resultReceiver - Your own BroadcastReceiver to treat as the final
> receiver of the broadcast.
>

-- 
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] How to listen for changes on Calls.CallLog

2010-05-31 Thread Donal Rafferty
Have you tried just doing the same with the CallLog content provider? -
CallLog.Calls.CONTENT_URI

On Mon, May 31, 2010 at 12:46 PM, mike  wrote:

> hi guys,
>
> is there a way to listen to changes in Calls.CallLog.
>  i have listen to SMS inbox changes using
>
> String url = "content://sms/";
>Uri uri = Uri.parse(url);
>
>getContentResolver().registerContentObserver(uri, true,
>new MyInboxListener(handler));
>
>Uri Sms = Uri.parse("content://sms/inbox");
>Cursor c = getContentResolver().query(Sms, null, null, null,
> null);
>
> is there a way to listene to CallLog using registerContentObserver.
>
> regards,
> Mike
>
> --
> 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] Re: Does Observer not work in a Android Service?

2010-05-31 Thread Donal Rafferty
Never mind! Monday Morning coding mistake, sorry!

On Mon, May 31, 2010 at 11:44 AM, draf...@gmail.com wrote:

> I am using the Observer pattern in my Android application to notify a
> running service that some data has changed:
>
> Here is the code outside the Service: (WifiConnectionManager)
>
> ---
>
>//Observables
>@Override
>public void NotifyQCLevelChange(QCLevel newQoSLevel) {
>setChanged();
>notifyObservers( newQoSLevel );
>}
>
>
>@Override
>public void NotifyQCPercentageChange(int percentage) {
>setChanged();
>notifyObservers( percentage );
>}
>
> ---
>
> Where the observables get updated within an Observer update method:
> (WifiConnectionManager)
>
> ---
>
>@Override
>public void update(Observable arg0, Object arg) {
>if( !iActive )
>return;
>
>if( arg0 instanceof WifiMonitor ){
>Log.d("WifiConnectionManager", "update from
> WiFiMonitor ss=:" +
> arg.toString());
>if(
> iConnectionState.equals(ConnectionState.IPACTIVE) )
>{
>int qcPercentage =
> Integer.parseInt(arg.toString());
>Log.d("GetActiveQCLevel", "GetActiveQCLevel
> called");
>QCLevel aConnectionQCLevel =
> GetActiveQCLevel(qcPercentage);
>
>
>if(
> !aConnectionQCLevel.equals(iConnectionQCLevel) )
>{
>iConnectionQCLevel =
> aConnectionQCLevel;
>
>  NotifyQCLevelChange(iConnectionQCLevel);
>Log.d("NotifyQCLevelChange",
> "NotifyQCLevelChange");
>}
>
>NotifyQCPercentageChange(qcPercentage);
>Log.d("NotifyQCPercentageChange",
> "NotifyQCPercentageChange");
>}
>}
>
> ---
>
> And finally the Observer in my service: (WifiService)
>
> ---
>
>@Override
>public void update(Observable observable, Object data) {
>
>if( observable instanceof WifiConnectionManager && data
> instanceof
> QCLevel){
>
>Log.d("WifiConnectionManager", "instanceof
> QCLevel");
>
>}
>else if( observable instanceof WifiConnectionManager && data
> instanceof Integer){
>
>Log.d("WifiConnectionManager", "instanceof
> Integer");
>
>}
>else if( observable instanceof WifiConnectionManager){
>
>Log.d("WifiConnectionManager", "instanceof
> WifiConnectionManager");
>
>}
>
> ---
>
> From the log I can see that Log.d("GetActiveQCLevel",
> "GetActiveQCLevel called"); &&
> Log.d("NotifyQCPercentageChange", "NotifyQCPercentageChange"); get
> called but nothing in the update method of the Observer in my service
> (WifiService) gets called.
>
> Can anyone see where the problem is or is there a restriction I am not
> aware of?

-- 
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: How to update a Widget dynamically (Not waiting 30 min for onUpdate to be called)?

2010-05-31 Thread Donal Rafferty
Argh! Timer was getting created over and over again, still if anyone can see
other improvements please let me know.

On Mon, May 31, 2010 at 10:18 AM, Donal Rafferty  wrote:

> Thanks all for the help.
>
> This is just a learning project for myself and wont be released on the
> Android market. So I am aware that it may not be the best approach but it is
> something to learn from.
>
> I have implemented the widget with the following code:
>
>
> public class WlanWidget extends AppWidgetProvider{
>
> RemoteViews remoteViews;
> AppWidgetManager appWidgetManager;
> ComponentName thisWidget;
> WifiManager wifiManager;
>
> public void onUpdate(Context context, AppWidgetManager
> appWidgetManager,
> int[] appWidgetIds) {
> Timer timer = new Timer();
> timer.scheduleAtFixedRate(new WlanTimer(context,
> appWidgetManager), 1, 1000);
>
>
> }
>
>
> private class WlanTimer extends TimerTask{
>
> RemoteViews remoteViews;
> AppWidgetManager appWidgetManager;
> ComponentName thisWidget;
>
> public WlanTimer(Context context, AppWidgetManager appWidgetManager) {
>
> this.appWidgetManager = appWidgetManager;
> remoteViews = new RemoteViews(context.getPackageName(),
> R.layout.widget);
> thisWidget = new ComponentName(context, WlanWidget.class);
> wifiManager =
> (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
>
>
> }
>
> @Override
> public void run() {
>
> remoteViews.setTextViewText(R.id.widget_textview,
> wifiManager.getConnectionInfo().getSSID());
> if((GlobalData.MIN_RSSI_LEVEL -
> (Math.abs(wifiManager.getConnectionInfo().getRssi())*2) <= 100)){
> remoteViews.setTextViewText(R.id.widget_percentage,
> (GlobalData.MIN_RSSI_LEVEL -
> (Math.abs(wifiManager.getConnectionInfo().getRssi())*2)+"%"));
> }
> else
> {
> remoteViews.setTextViewText(R.id.widget_percentage,
> "100%");
> }
> appWidgetManager.updateAppWidget(thisWidget, remoteViews);
> }
>
> }
>
> }
>
> This appears to work fine but it then seems to make the
> android.process.acore crash, it also crashes theandroid.process.acore if I
> try to long press on the widget.
>
> I get the following messages in logcat then:
>
> 05-31 10:12:49.158: WARN/WindowManager(88): Key dispatching timed out
> sending to com.android.launcher/com.android.launcher.Launcher
> 05-31 10:12:49.168: WARN/WindowManager(88): Dispatch state:
> {{KeyEvent{action=1 code=82 repeat=0 meta=0 scancode=139 mFlags=8} to
> Window{433114a0 com.android.launcher/com.android.launcher.Launcher
> paused=false} @ 1275296936375 lw=Window{433114a0
> com.android.launcher/com.android.launcher.Launcher paused=false}
> lb=android.os.binderpr...@43311228 fin=false gfw=true ed=true tts=0
> wf=false fp=false mcf=Window{433114a0
> com.android.launcher/com.android.launcher.Launcher paused=false}}}
> 05-31 10:12:49.168: WARN/WindowManager(88): Current state:  {{null to
> Window{433114a0 com.android.launcher/com.android.launcher.Launcher
> paused=false} @ 1275297169174 lw=Window{433114a0
> com.android.launcher/com.android.launcher.Launcher paused=false}
> lb=android.os.binderpr...@43311228 fin=false gfw=true ed=true tts=0
> wf=false fp=false mcf=Window{433114a0
> com.android.launcher/com.android.launcher.Launcher paused=false}}}
> 05-31 10:12:49.238: INFO/ActivityManager(88): ANR in process:
> android.process.acore (last in android.process.acore)
> 05-31 10:12:49.238: INFO/ActivityManager(88): Annotation:
> keyDispatchingTimedOut
> 05-31 10:12:49.238: INFO/ActivityManager(88): CPU usage:
> 05-31 10:12:49.238: INFO/ActivityManager(88): Load: 5.93 / 3.18 / 1.33
> 05-31 10:12:49.238: INFO/ActivityManager(88): CPU usage from 16159ms to
> 59ms ago:
> 05-31 10:12:49.238: INFO/ActivityManager(88):   android.process.acore: 77%
> = 77% user + 0% kernel / faults: 286 minor
> 05-31 10:12:49.238: INFO/ActivityManager(88):   system_server: 16% = 14%
> user + 1% kernel / faults: 213 minor
> 05-31 10:12:49.238: INFO/ActivityManager(88):   com.networks: 4% = 4% user
> + 0% kernel / faults: 365 minor
> 05-31 10:12:49.238: INFO/ActivityManager(88):   synaptics_wq: 0% = 0% user
> + 0% kernel
> 05-31 10:12:49.238: INFO/ActivityManager(88):   wpa_supplicant: 0% = 0%
> user + 0% kernel
> 05-31 10:12:49.238: INFO/ActivityManager(88):   tiwlan_wifi_wq: 0% = 0%
> user + 0% kernel
> 05-31 10:12:49.238: INFO/ActivityManager(88):   events/0: 0% = 0% user + 0%
>

Re: [android-developers] Re: How to update a Widget dynamically (Not waiting 30 min for onUpdate to be called)?

2010-05-31 Thread Donal Rafferty
Thanks all for the help.

This is just a learning project for myself and wont be released on the
Android market. So I am aware that it may not be the best approach but it is
something to learn from.

I have implemented the widget with the following code:

public class WlanWidget extends AppWidgetProvider{

RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
WifiManager wifiManager;

public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new WlanTimer(context,
appWidgetManager), 1, 1000);

}


private class WlanTimer extends TimerTask{

RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;

public WlanTimer(Context context, AppWidgetManager appWidgetManager) {

this.appWidgetManager = appWidgetManager;
remoteViews = new RemoteViews(context.getPackageName(),
R.layout.widget);
thisWidget = new ComponentName(context, WlanWidget.class);
wifiManager =
(WifiManager)context.getSystemService(Context.WIFI_SERVICE);


}

@Override
public void run() {

remoteViews.setTextViewText(R.id.widget_textview,
wifiManager.getConnectionInfo().getSSID());
if((GlobalData.MIN_RSSI_LEVEL -
(Math.abs(wifiManager.getConnectionInfo().getRssi())*2) <= 100)){
remoteViews.setTextViewText(R.id.widget_percentage,
(GlobalData.MIN_RSSI_LEVEL -
(Math.abs(wifiManager.getConnectionInfo().getRssi())*2)+"%"));
}
else
{
remoteViews.setTextViewText(R.id.widget_percentage,
"100%");
}
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
}

}

}

This appears to work fine but it then seems to make the
android.process.acore crash, it also crashes theandroid.process.acore if I
try to long press on the widget.

I get the following messages in logcat then:

05-31 10:12:49.158: WARN/WindowManager(88): Key dispatching timed out
sending to com.android.launcher/com.android.launcher.Launcher
05-31 10:12:49.168: WARN/WindowManager(88): Dispatch state:
{{KeyEvent{action=1 code=82 repeat=0 meta=0 scancode=139 mFlags=8} to
Window{433114a0 com.android.launcher/com.android.launcher.Launcher
paused=false} @ 1275296936375 lw=Window{433114a0
com.android.launcher/com.android.launcher.Launcher paused=false}
lb=android.os.binderpr...@43311228 fin=false gfw=true ed=true tts=0 wf=false
fp=false mcf=Window{433114a0
com.android.launcher/com.android.launcher.Launcher paused=false}}}
05-31 10:12:49.168: WARN/WindowManager(88): Current state:  {{null to
Window{433114a0 com.android.launcher/com.android.launcher.Launcher
paused=false} @ 1275297169174 lw=Window{433114a0
com.android.launcher/com.android.launcher.Launcher paused=false}
lb=android.os.binderpr...@43311228 fin=false gfw=true ed=true tts=0 wf=false
fp=false mcf=Window{433114a0
com.android.launcher/com.android.launcher.Launcher paused=false}}}
05-31 10:12:49.238: INFO/ActivityManager(88): ANR in process:
android.process.acore (last in android.process.acore)
05-31 10:12:49.238: INFO/ActivityManager(88): Annotation:
keyDispatchingTimedOut
05-31 10:12:49.238: INFO/ActivityManager(88): CPU usage:
05-31 10:12:49.238: INFO/ActivityManager(88): Load: 5.93 / 3.18 / 1.33
05-31 10:12:49.238: INFO/ActivityManager(88): CPU usage from 16159ms to 59ms
ago:
05-31 10:12:49.238: INFO/ActivityManager(88):   android.process.acore: 77% =
77% user + 0% kernel / faults: 286 minor
05-31 10:12:49.238: INFO/ActivityManager(88):   system_server: 16% = 14%
user + 1% kernel / faults: 213 minor
05-31 10:12:49.238: INFO/ActivityManager(88):   com.networks: 4% = 4% user +
0% kernel / faults: 365 minor
05-31 10:12:49.238: INFO/ActivityManager(88):   synaptics_wq: 0% = 0% user +
0% kernel
05-31 10:12:49.238: INFO/ActivityManager(88):   wpa_supplicant: 0% = 0% user
+ 0% kernel
05-31 10:12:49.238: INFO/ActivityManager(88):   tiwlan_wifi_wq: 0% = 0% user
+ 0% kernel
05-31 10:12:49.238: INFO/ActivityManager(88):   events/0: 0% = 0% user + 0%
kernel
05-31 10:12:49.238: INFO/ActivityManager(88):   adbd: 0% = 0% user + 0%
kernel
05-31 10:12:49.238: INFO/ActivityManager(88): TOTAL: 100% = 96% user + 3%
kernel
05-31 10:12:49.248: INFO/ActivityManager(88): Removing old ANR trace file
from /data/anr/traces.txt
05-31 10:12:49.288: INFO/Process(88): Sending signal. PID: 147 SIG: 3
05-31 10:12:49.288: INFO/dalvikvm(147): threadid=7: reacting to signal 3
05-31 10:12:49.488: INFO/Process(88): Sending signal. PID: 88 SIG: 3
05-31 10:12:49.488: INFO/dalvikvm(88): threadid=7: reacting to signal 3
05-31 10:12:49.578: INFO/dalvikvm(147): Wrote stack trace to
'/data/anr/traces.txt'

Can anyone help with the problem? Or pin point the area the problem is
coming from?

Thanks in advance


On

[android-developers] Re: Get Notified when a new access point is added?

2010-05-27 Thread Donal Rafferty
Would using NETWORK_IDS_CHANGED_ACTION be an option?

http://developer.android.com/intl/de/reference/android/net/wifi/WifiManager.html#NETWORK_IDS_CHANGED_ACTION

On Wed, May 26, 2010 at 4:38 PM, draf...@gmail.com wrote:

> I was wondering is it possible to get a notification of when a new
> configured network is added to the WifiManager in Android?
>
> I know you can get the current list of configured networks
>
>
> http://developer.android.com/intl/de/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks%28%29
>
> But is it possible to get notification of when a new one is added?
>
> I dont see anything in the WifiManager that would be helpful.
>
> Has anyone any other ideas? Or insight into how this could be
> achieved?
>
>
>

-- 
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] How to scan Access Points and select strongest signal?

2010-05-26 Thread Donal Rafferty
Thanks again Kostya,

One final thing (well final for now, I'll probably run into more problems
after testing)

I was wondering what method you chose to convert the RSSI to a percentage?

I have been reading up on it and found the formula that uses RSSI_MAX value
but I'm unsure of the max RSSI value of the Wifi adapters.

Another way I thought about doing it is using the calculateSignal method and
converting to a percentage that way.

Can you provide any guidance on the matter?

2010/5/18 Kostya Vasilyev 

>  Donal,
>
> It's in scanResult.capabilites, and it's a pretty self-explanatory string.
>
> describeCapabilities is inhertied from Parcelable and has to do with
> persistence.
>
> -- Kostya
>
> 18.05.2010 12:48, Donal Rafferty пишет:
>
> Very good tutorial there, thanks.
>
> One thing missing though is how you decide whether a scan result is an open
> netowrk or one using WEP or WPA/WPA2?
>
> Do you have to use scanResult.describeContents() or scanResult.capabilities
> in some way to determine which type of network to add?
>
>
>
> 2010/5/18 Kostya Vasilyev 
>
>> Donald,
>>
>> Yes, obviously it's possible - Android's built-it UI for connection
>> management does it somehow :)
>>
>> In my program, I do it like this:
>>
>>
>> http://kmansoft.wordpress.com/2010/04/08/adding-wifi-networks-to-known-list/
>>
>> --
>> Kostya Vasilev -- WiFi Manager + pretty widget -
>> https://kmansoft.wordpress.com
>>
>> 18.05.2010 12:25, Donal Rafferty пишет:
>>
>> Thanks Kostya, I think I'm nearly there.
>>
>> My current problem is adding a new configured access point.
>>
>> I have it hard coded in my code as follows:
>>
>> ---
>>
>> WifiConfiguration wc = new WifiConfiguration();
>> wc.SSID = '"'+scanResult.SSID+'"';
>> wc.status = WifiConfiguration.Status.ENABLED;
>>
>> wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
>>
>> wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
>> wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
>> wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
>> wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
>>
>> wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
>>
>> wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
>> wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
>> wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
>> int res = mainWifi.addNetwork(wc);
>> Log.d("WifiPreference", "add Network returned " + res );
>> boolean b = mainWifi.enableNetwork(res, true);
>> Log.d("WifiPreference", "enableNetwork returned " + b );
>>
>> --
>>
>> But is there a way I can get the information needed from a Scan Result to
>> add a new Wifi configuration? Things like PairwiseCiphers, Protocols,
>> AuthAlgorithms, KeyManagement I cant see a method to retrieve that info from
>> a Scan result.
>>
>> Is it possible?
>>
>> 2010/5/14 Kostya Vasilyev 
>>
>>> Donald,
>>>
>>> Yes, your algorithm is correct. Only add network from the scan list to
>>> the known list if not already there.
>>>
>>> As for scanning on the move, take a look at wake locks.
>>>
>>> 14 мая, 2010 5:35 PM пользователь "Donal Rafferty" 
>>> написал:
>>>
>>>
>>> Thanks again Kostya,
>>>
>>> I have downloaded your app and had a look, its very nice, the widget will
>>> come in very handy for my testing!
>>>
>>> I was aware of the "known" versus as is quotes.
>>>
>>> My problem is for my app to work I need it to scan for AP's when the
>>> device is on the move.
>>>
>>> So it should scan, find a new AP that has the highest RSSI in the area
>>> and connect to that.
>>>
>>> The problem is I can only connect to a "known" or already configured AP
>>> and not one resulting from a scan.
>>>
>>> So would I be correct in saying that I need to do the following?
>>>
>>> Scan
>>> Get the highest RSSI
>>> Compare the SSID of this AP to the Wifi Config list
>>> If its in the Wifi config list then connect
>>> If its not then add a new access point (As a configured AP)
>>> Get the id of

Re: [android-developers] How to scan Access Points and select strongest signal?

2010-05-18 Thread Donal Rafferty
Very good tutorial there, thanks.

One thing missing though is how you decide whether a scan result is an open
netowrk or one using WEP or WPA/WPA2?

Do you have to use scanResult.describeContents() or scanResult.capabilities
in some way to determine which type of network to add?



2010/5/18 Kostya Vasilyev 

>  Donald,
>
> Yes, obviously it's possible - Android's built-it UI for connection
> management does it somehow :)
>
> In my program, I do it like this:
>
>
> http://kmansoft.wordpress.com/2010/04/08/adding-wifi-networks-to-known-list/
>
> --
> Kostya Vasilev -- WiFi Manager + pretty widget -
> https://kmansoft.wordpress.com
>
> 18.05.2010 12:25, Donal Rafferty пишет:
>
> Thanks Kostya, I think I'm nearly there.
>
> My current problem is adding a new configured access point.
>
> I have it hard coded in my code as follows:
>
> ---
>
> WifiConfiguration wc = new WifiConfiguration();
> wc.SSID = '"'+scanResult.SSID+'"';
> wc.status = WifiConfiguration.Status.ENABLED;
> wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
>
> wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
> wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
> wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
> wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
>
> wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
>
> wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
> wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
> wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
> int res = mainWifi.addNetwork(wc);
> Log.d("WifiPreference", "add Network returned " + res );
> boolean b = mainWifi.enableNetwork(res, true);
> Log.d("WifiPreference", "enableNetwork returned " + b );
>
> --
>
> But is there a way I can get the information needed from a Scan Result to
> add a new Wifi configuration? Things like PairwiseCiphers, Protocols,
> AuthAlgorithms, KeyManagement I cant see a method to retrieve that info from
> a Scan result.
>
> Is it possible?
>
> 2010/5/14 Kostya Vasilyev 
>
>> Donald,
>>
>> Yes, your algorithm is correct. Only add network from the scan list to the
>> known list if not already there.
>>
>> As for scanning on the move, take a look at wake locks.
>>
>> 14 мая, 2010 5:35 PM пользователь "Donal Rafferty" 
>> написал:
>>
>>
>> Thanks again Kostya,
>>
>> I have downloaded your app and had a look, its very nice, the widget will
>> come in very handy for my testing!
>>
>> I was aware of the "known" versus as is quotes.
>>
>> My problem is for my app to work I need it to scan for AP's when the
>> device is on the move.
>>
>> So it should scan, find a new AP that has the highest RSSI in the area and
>> connect to that.
>>
>> The problem is I can only connect to a "known" or already configured AP
>> and not one resulting from a scan.
>>
>> So would I be correct in saying that I need to do the following?
>>
>> Scan
>> Get the highest RSSI
>> Compare the SSID of this AP to the Wifi Config list
>> If its in the Wifi config list then connect
>> If its not then add a new access point (As a configured AP)
>> Get the id of the newly added AP and connect
>>
>>
>>  On Fri, May 14, 2010 at 1:47 PM, Kostya Vasilyev 
>> wrote: > > Donal, > > I think...
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Android Developers" group...
>>
>> --
>>  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
>
>
>  --

Re: [android-developers] How to scan Access Points and select strongest signal?

2010-05-18 Thread Donal Rafferty
Thanks Kostya, I think I'm nearly there.

My current problem is adding a new configured access point.

I have it hard coded in my code as follows:

---

WifiConfiguration wc = new WifiConfiguration();
wc.SSID = '"'+scanResult.SSID+'"';
wc.status = WifiConfiguration.Status.ENABLED;
wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);

wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);

wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);

wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
int res = mainWifi.addNetwork(wc);
Log.d("WifiPreference", "add Network returned " + res );
boolean b = mainWifi.enableNetwork(res, true);
Log.d("WifiPreference", "enableNetwork returned " + b );

--

But is there a way I can get the information needed from a Scan Result to
add a new Wifi configuration? Things like PairwiseCiphers, Protocols,
AuthAlgorithms, KeyManagement I cant see a method to retrieve that info from
a Scan result.

Is it possible?

2010/5/14 Kostya Vasilyev 

> Donald,
>
> Yes, your algorithm is correct. Only add network from the scan list to the
> known list if not already there.
>
> As for scanning on the move, take a look at wake locks.
>
> 14 мая, 2010 5:35 PM пользователь "Donal Rafferty" 
> написал:
>
>
> Thanks again Kostya,
>
> I have downloaded your app and had a look, its very nice, the widget will
> come in very handy for my testing!
>
> I was aware of the "known" versus as is quotes.
>
> My problem is for my app to work I need it to scan for AP's when the device
> is on the move.
>
> So it should scan, find a new AP that has the highest RSSI in the area and
> connect to that.
>
> The problem is I can only connect to a "known" or already configured AP and
> not one resulting from a scan.
>
> So would I be correct in saying that I need to do the following?
>
> Scan
> Get the highest RSSI
> Compare the SSID of this AP to the Wifi Config list
> If its in the Wifi config list then connect
> If its not then add a new access point (As a configured AP)
> Get the id of the newly added AP and connect
>
>
> On Fri, May 14, 2010 at 1:47 PM, Kostya Vasilyev 
> wrote: > > Donal, > > I think...
> --
>
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group...
>
>  --
> 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

Re: [android-developers] How to scan Access Points and select strongest signal?

2010-05-14 Thread Donal Rafferty
Thanks again Kostya,

I have downloaded your app and had a look, its very nice, the widget will
come in very handy for my testing!

I was aware of the "known" versus as is quotes.

My problem is for my app to work I need it to scan for AP's when the device
is on the move.

So it should scan, find a new AP that has the highest RSSI in the area and
connect to that.

The problem is I can only connect to a "known" or already configured AP and
not one resulting from a scan.

So would I be correct in saying that I need to do the following?

Scan
Get the highest RSSI
Compare the SSID of this AP to the Wifi Config list
If its in the Wifi config list then connect
If its not then add a new access point (As a configured AP)
Get the id of the newly added AP and connect



On Fri, May 14, 2010 at 1:47 PM, Kostya Vasilyev  wrote:

>  Donal,
>
> I think you are not matching the SSIDs of known and live networks
> correctly.
>
> The SSIDs in the "known" list are enclosed in double quotes:
>
>
> http://developer.android.com/reference/android/net/wifi/WifiConfiguration.html#SSID
>
> The SSIDs in the live scan result list are "as is", without the quotes.
>
> Your code needs to take this into consideration when matching the networks
> between the two lists.
>
> BTW, feel free to download and try my WiFi management tool, I think it
> should make it easier to see what's going on. See the link in my signature
> below.
>
> --
> Kostya Vasilyev ~ WiFi Manager + pretty widget ~ 
> http://kmansoft.wordpress.com/sw
>
>
> 14.05.2010 14:33, Donal Rafferty пишет:
>
> Thanks for that Kostya
>
> I have come across a bit of a problem though.
>
> After a scan there are 11 AP's found and all 11 show up in the list in the
> Wifi settings on the device.
>
> But when I use 
> getConfiguredNetworks<http://developer.android.com/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks>()
> it only returns 4 configured networks.
>
> This happens despite the 11 AP's showing up in the settings after a scan.
>
> So the majority of the time when I compared the AP with the best signal's
> SSID with the SSID's in the Configured Network list the majority of the time
> no matching SSID is found.
>
> In that case I try to add a new network but this ends up creating
> duplicates of the AP in the settings list.
>
> On Thu, May 13, 2010 at 5:24 PM, Kostya Vasilyev wrote:
>
>> Hi,
>>
>> 1. Regarding duplicates. Android maintains a list of "known" networks -
>> for each, it stores the SSID, encryption configuration, along with the
>> password, if necessary. Each known network also has a unique numeric ID.
>>
>> You can only connect to networks on this "known" list, because, as you
>> correctly figured out, connecting to a network is done by its id.
>>
>> However, it's not necessary to add the network to this list if it's
>> already been added (by Android or by your application).
>>
>> You can get the list of known networks from the WifiManager:
>>
>>
>> http://developer.android.com/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks
>> ()
>>
>> You can match these networks to your live scan results using their SSIDs.
>> If the network is already in the known list, just use its numeric id. If
>> not, you get the numeric ID back from addNetwork().
>>
>> 2. Once you have the numeric ID, call enableNetwork(networkId, true) to
>> connect. The second parameter means "disconnect from others", not "forget
>> all other network" as its name might seem to imply.
>>
>> -- Kostya Vasilyev
>>
>>
>> 2010/5/13 draf...@gmail.com 
>>
>>>  I am currently trying to write a class in Android that will Scan for
>>> access points, calculate which access point has the best signal and
>>> then connect to that access point.
>>>
>>>
>>> So the application will be able to scan on the move and attach to new
>>> access points on the go.
>>>
>>> I have the scanning and calculation of the best signal working.
>>>
>>> But when it comes to attaching to the best access point I am having
>>> trouble.
>>>
>>> It appears that enableNetwork(netid, othersTrueFalse) is the only
>>> method for attaching to an Access point but this causes problems as
>>> from my Scan Results I am not able to get the id of the access point
>>> with the strongest signal.
>>>
>>> This is my code:
>>>
>>> ---
>>>
>>>public void doWifiScan(){
>

Re: [android-developers] How to scan Access Points and select strongest signal?

2010-05-14 Thread Donal Rafferty
Thanks for that Kostya

I have come across a bit of a problem though.

After a scan there are 11 AP's found and all 11 show up in the list in the
Wifi settings on the device.

But when I use 
getConfiguredNetworks()
it only returns 4 configured networks.

This happens despite the 11 AP's showing up in the settings after a scan.

So the majority of the time when I compared the AP with the best signal's
SSID with the SSID's in the Configured Network list the majority of the time
no matching SSID is found.

In that case I try to add a new network but this ends up creating duplicates
of the AP in the settings list.

On Thu, May 13, 2010 at 5:24 PM, Kostya Vasilyev  wrote:

> Hi,
>
> 1. Regarding duplicates. Android maintains a list of "known" networks - for
> each, it stores the SSID, encryption configuration, along with the password,
> if necessary. Each known network also has a unique numeric ID.
>
> You can only connect to networks on this "known" list, because, as you
> correctly figured out, connecting to a network is done by its id.
>
> However, it's not necessary to add the network to this list if it's already
> been added (by Android or by your application).
>
> You can get the list of known networks from the WifiManager:
>
>
> http://developer.android.com/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks
> ()
>
> You can match these networks to your live scan results using their SSIDs.
> If the network is already in the known list, just use its numeric id. If
> not, you get the numeric ID back from addNetwork().
>
> 2. Once you have the numeric ID, call enableNetwork(networkId, true) to
> connect. The second parameter means "disconnect from others", not "forget
> all other network" as its name might seem to imply.
>
> -- Kostya Vasilyev
>
>
> 2010/5/13 draf...@gmail.com 
>
>> I am currently trying to write a class in Android that will Scan for
>> access points, calculate which access point has the best signal and
>> then connect to that access point.
>>
>>
>> So the application will be able to scan on the move and attach to new
>> access points on the go.
>>
>> I have the scanning and calculation of the best signal working.
>>
>> But when it comes to attaching to the best access point I am having
>> trouble.
>>
>> It appears that enableNetwork(netid, othersTrueFalse) is the only
>> method for attaching to an Access point but this causes problems as
>> from my Scan Results I am not able to get the id of the access point
>> with the strongest signal.
>>
>> This is my code:
>>
>> ---
>>
>>public void doWifiScan(){
>>
>>  scanTask = new TimerTask() {
>>  public void run() {
>>  handler.post(new Runnable() {
>>  public void run() {
>>   sResults = wifiManager.scan(getBaseContext());
>>   if(sResults!=null)
>>   Log.d("TIMER", "sResults count" + sResults.size());
>>   ScanResult scan =
>> wifiManager.calculateBestAP(sResults);
>>   wifiManager.addNewAccessPoint(scan);
>>   }
>>   });
>>}};
>>
>>t.schedule(scanTask, 3000, 3);
>>}
>>
>>
>> ---
>>
>>public ScanResult calculateBestAP(List sResults){
>>
>> ScanResult bestSignal = null;
>>for (ScanResult result : sResults) {
>>  if (bestSignal == null
>>  ||
>> WifiManager.compareSignalLevel(bestSignal.level,
>> result.level) < 0)
>>bestSignal = result;
>>}
>>
>>String message = String.format("%s networks found. %s
>> is the
>> strongest. %s is the bsid",
>>sResults.size(), bestSignal.SSID,
>> bestSignal.BSSID);
>>
>>Log.d("sResult", message);
>>return bestSignal;
>>}
>>
>>
>> ---
>>
>>public void addNewAccessPoint(ScanResult scanResult){
>>
>>WifiConfiguration wc = new WifiConfiguration();
>>wc.SSID = '\"' + scanResult.SSID + '\"';
>>//wc.preSharedKey  = "\"password\"";
>>wc.hiddenSSID = true;
>>wc.status = WifiConfiguration.Status.ENABLED;
>>
>>  wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
>>
>>  wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
>>
>>  wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
>>
>> wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
>>
>> wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
>>wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
>>int res = mainWifi.addNetwork(wc);
>>Log.d("WifiPreference", "add Network returned " + res );
>>boolean b = mainWifi.enableNetwork(res, false);
>>Log.d("WifiPr

Re: [android-developers] Re: Audio stuttering when using AudioTrack.

2010-04-15 Thread Donal Rafferty
Hi Niko,

Do you just process Audio buffers in the NDK, you dont actually access any
low level audio classes or streams?

On Thu, Apr 15, 2010 at 4:51 PM, niko20  wrote:

> Also was going to mention that in Android foreground apps always get
> priority in scheduling regardless of thread priority. Read that in
> these forums somewhere.
>
> -niko
>
> On Apr 15, 10:50 am, niko20  wrote:
> > This is why I've moved any new projects that generate audio in the NDK
> > to create the audio data and pass the buffers back to me. I've seen an
> > increase in speed in buffer creation (44Khz stereo sound) from 400ms
> > down to 10ms or so to mix a buffer, over 100x speed increase.
> >
> > It's best to put any audio processing in the NDK to get max speed
> > possible.
> >
> > -niko
> >
> > On Apr 15, 3:35 am, Jesper Hansen  wrote:
> >
> >
> >
> > > On my N1, my player spends around 15-30% of its time generating the
> audio
> > > data. The my player app  has focus everything sounds fine, but when I
> start
> > > another app that also requires a lot of cpu time the sounds start to
> stutter
> > > badly.
> >
> > > Using top and ps on the N1, I can see that the applications that causes
> my
> > > sounds to stutter, have a nice value of 0 (THREAD_PRIORITY_DEFAULT).
> > > It puzzles me why these applications get more attention from the
> > > scheduler,than my thread, which runs at nice level -16
> > > (THREAD_PRIORITY_AUDIO).
> >
> > > On Thu, Apr 15, 2010 at 04:01, ani 
> wrote:
> > > > So what you are trying to say is in-between(time it takes to play the
> > > > audio) the audio writes you are doing some
> > > > cpu intensive operations which is causing this stuttering ???
> >
> > > > --
> > > > 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 cr...@googlegroups.com>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > To unsubscribe, reply using "remove me" as the subject.
>
> --
> 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

Re: [android-developers] Paid apps in more countries - I am sick about it

2010-04-14 Thread Donal Rafferty
Apologies for my spelling:

I believe by the end of the year there will be enough Android users to make
an Irish paid market worthwhile but its been quite clear a paid apps market
in Ireland so far hasn't made sense.

On Wed, Apr 14, 2010 at 5:07 PM, Donal Rafferty  wrote:

> Might be helpful if you state which country your in and want the paid
> market to come to?
>
> I'm in Ireland and to be honest Android is only starting to take off here
> so there was no sense in having  a paid market here.
>
> I believe by the end of the year there will be enough Android users to make
> an Irish paid market worthwhile but its been quiet clean a paid apps market
> in Ireland so far hasn't made sense.
>
>
>
>
> On Wed, Apr 14, 2010 at 4:48 PM, fhucho  wrote:
>
>> Last year in October I was told by Reto Meier that expanding support
>> for paid apps in Android Market is the top priority for the Market
>> team. Now, six month later, I don't beleive he was telling the truth.
>>
>> I am really sick about this. Maybe this is a way for Google to keep
>> the app prices low - there will be many good free apps on the market
>> from developers who can't release a paid version. This will also keep
>> the price of the paid apps lower (because the user might switch to
>> competitor's app that is free).
>>
>> The thing I am sick even more is that they are not able to give out
>> any other response than "We're woking on it" (which I find a bit hard
>> to beleive, they're working on it for over a year with no result).
>> When I ask a very simpe question, "Will it happen in 2010 or later?",
>> they answer with silence.
>>
>> I haven't found any forum about this that has some official reply from
>> a Googler. I guess this post will be also left without an answer from
>> anyone from Google. Why is Google so secretive about this?
>>
>> --
>> 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
>>
>> To unsubscribe, reply using "remove me" as the subject.
>>
>
>

-- 
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] Paid apps in more countries - I am sick about it

2010-04-14 Thread Donal Rafferty
Might be helpful if you state which country your in and want the paid market
to come to?

I'm in Ireland and to be honest Android is only starting to take off here so
there was no sense in having  a paid market here.

I believe by the end of the year there will be enough Android users to make
an Irish paid market worthwhile but its been quiet clean a paid apps market
in Ireland so far hasn't made sense.



On Wed, Apr 14, 2010 at 4:48 PM, fhucho  wrote:

> Last year in October I was told by Reto Meier that expanding support
> for paid apps in Android Market is the top priority for the Market
> team. Now, six month later, I don't beleive he was telling the truth.
>
> I am really sick about this. Maybe this is a way for Google to keep
> the app prices low - there will be many good free apps on the market
> from developers who can't release a paid version. This will also keep
> the price of the paid apps lower (because the user might switch to
> competitor's app that is free).
>
> The thing I am sick even more is that they are not able to give out
> any other response than "We're woking on it" (which I find a bit hard
> to beleive, they're working on it for over a year with no result).
> When I ask a very simpe question, "Will it happen in 2010 or later?",
> they answer with silence.
>
> I haven't found any forum about this that has some official reply from
> a Googler. I guess this post will be also left without an answer from
> anyone from Google. Why is Google so secretive about this?
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
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: Service vs Singleton

2010-04-09 Thread Donal Rafferty
The singleton wont be killed by the system automatically like a service
which could lead to GC problems

On Fri, Apr 9, 2010 at 1:51 PM, ailinykh  wrote:

>
>
> >
> > Using a service gives you:
> >
> > 1. Less chance of garbage collection problems from failing to null out
> > the singleton.
> >
> This one I don't understand. What do you mean?
>
> Andrey
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
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] Is it possible to have 3G and Wifi connections at the same time?

2010-03-07 Thread Donal Rafferty
Thanks, much appreciated

On Fri, Mar 5, 2010 at 5:46 PM, Mark Murphy  wrote:

> Donal Rafferty wrote:
> > Not even with the NDK?
>
> The NDK has very little formal access to Android internals and certainly
> cannot rewrite them.
>
> Now, with firmware changes, it is at least theoretically possible.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> _Beginning Android_ from Apress Now Available!
>
> --
> 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

Re: [android-developers] Is it possible to have 3G and Wifi connections at the same time?

2010-03-05 Thread Donal Rafferty
Not even with the NDK?

On Fri, Mar 5, 2010 at 4:51 PM, Mark Murphy  wrote:

> draf...@gmail.com wrote:
> > I was wondering does anyone know if its possible to open a wifi and a
> > 3g connection at the same time on Android?
>
> No.
>
> > Is there any way to control access to both Wifi and 3g/GPRS data
> > connections and use them at the same time?
>
> No.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android Development Wiki: http://wiki.andmob.org
>
> --
> 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

Re: [android-developers] Re: Supress the native In Call Screen and replace with 3rd party?

2010-03-05 Thread Donal Rafferty
Thanks James, unfortunately porting and getting Roms to customers doesn't
make sense

On Fri, Mar 5, 2010 at 4:12 PM, James Wang  wrote:

> You can do nothing on this subject with sdk.
> I think you should go for some help on android porting.
>
> --
> 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

Re: [android-developers] Making sure activity is alive to receive Intent?

2010-03-05 Thread Donal Rafferty
Thanks Sean, they are two additional methods I can look into now much
appreciated

On Fri, Mar 5, 2010 at 4:22 PM, Sean Hodges wrote:

> There are better ways of handling this. The purpose of an Intent is to
> atomically request that an action is performed (and optionally
> retrieve the result of that action), not to continue a discussion with
> the activity throughout it's continued lifetime.
>
> There are a number of ways to do what you want, if both the calling
> and callee activities are in the same app (just a startActivity() type
> call), you could use shared preferences:
>
>
> http://www.androidcompetencycenter.com/2009/01/android-basics-managing-activity-states-part-ii/
>
> If the activities are in different apps, you should use a content
> provider to handle the IPC:
>
>
> http://developer.android.com/intl/de/guide/topics/providers/content-providers.html
>
> Either approach will allow you to share the state data between your
> activities.
>
>
> On Fri, Mar 5, 2010 at 11:22 AM, draf...@gmail.com 
> wrote:
> > I currently have an application that has code in it that starts an
> > Activity but shortly afterwards it also sends an intent so the newly
> > started activity knows what state to display in.
> >
> > So the activity starts...
> >
> > then code decides it should be in state one
> >
> > button 1 and 2 are displayed.
> >
> > Or
> >
> > The activity starts...
> >
> > then code decides it should be in state one
> >
> > button 3 and 4 are displayed.
> >
> > So it kind of works at the minute but sometimes my activity isn't
> > fully started when the intent is fired so the intent fires before the
> > receiver in the new activity is registered and the new activity stays
> > in a blank state.
> >
> > Is there anyway to make sure my Activity is started and receiver
> > registered before firing the intent?
> >
> > --
> > 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
>

-- 
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] Re: Is passing AMR_NB into AudioTrack and AudioRecord valid?

2010-02-04 Thread Donal Rafferty
Anyone?

On Wed, Feb 3, 2010 at 5:24 PM, draf...@gmail.com  wrote:

> I currently use AudioTrack and AudioRecord to create a looping sound
> program and I was using raw PCM audio but I want to use AMR_NB audio
> so I set up the code as follows
>
> arec = new AudioRecord(MediaRecorder.AudioSource.MIC,
>   11025,
>
> AudioFormat.CHANNEL_CONFIGURATION_MONO,
>
> MediaRecorder.AudioEncoder.AMR_NB,
>   buffersize);
> atrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL,
>   11025,
>
> AudioFormat.CHANNEL_CONFIGURATION_MONO,
>
> MediaRecorder.AudioEncoder.AMR_NB,
>   buffersize,
>
> AudioTrack.MODE_STREAM);
>
> The above code works fine but is passing
> MediaRecorder.AudioEncoder.AMR_NB in as the Audio Format valid or is
> it working but actually not being encoded as AMR_NB?
>
>

-- 
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: Record raw Audio, process audio and save as ogg or another compressed format

2010-01-27 Thread Donal Rafferty
Have you looked at the MediaRecorder class? As far as I know it allows some
encoding and compression

On Wed, Jan 27, 2010 at 5:04 PM, maecky  wrote:

> Push.
> Does no one have any suggestions?
>
> regards Maecky
>
> On 17 Jan., 21:24, maecky  wrote:
> > Hi,
> > I have searched the whole group but wasn't able to find a answer for
> > my problem.
> >
> > I want to record audio from the microphone,  apply some audio signal
> > processing and than save the processed audio data in a compressed
> > format.
> >
> > I figured out, how to record audio uncompressed but now I wonder if I
> > can use some api functions to store this data in a supported
> > compressed format.
> >
> > Has anyone some suggestions?
> >
> > Thanks for your help
> > regards Maecky
>
> --
> 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

Re: [android-developers] Re: Loop audio from mic to earpiece?

2010-01-25 Thread Donal Rafferty
Just to update you a bit

this code works in 1.5 :

audio_service.setSpeakerphoneOn(false);
audio_service.setMode(AudioManager.MODE_IN_CALL);
audio_service.setRouting(AudioManager.MODE_NORMAL,
AudioManager.ROUTE_EARPIECE,
AudioManager.ROUTE_ALL);

However I've yet to find a solution for 1.6 +

Any help would be greatly appreciated

Thanks

On Mon, Jan 25, 2010 at 9:19 AM, Donal Rafferty  wrote:

> Hi Ani,
>
> I am working on 1.5 (CupCake) and have tried to use the setRouting method,
> however the audio still appears to be coming out of the speaker.
>
> I also have an eclair device and the audio is coming out of the speaker on
> that device too.
>
> I have tried using the Audiomanager and the STREAM_VOICE_CALL also but with
> no luck at all.
>
> My code is posted above in case I may be using the methods the wrong way?
>
>
> On Mon, Jan 25, 2010 at 3:09 AM, ani  wrote:
>
>> >Not 100% sure about the earpiece, but you specify a stream when you
>> >create the AudioTrack and I think a stream encpsulates audio routing
>> >and volume amongst possibly other things.
>>
>> >If you set the stream to STREAM_VOICE_CALL it might come through the
>> >earpiece as this is where a call would be routed, although I guess
>> >that depends on headsets and stuff.
>> >Can anyone clarify if I am right?
>>
>> As for earpiece routing we can route audio to earpiece using
>> setrouting call in the case of cupcake.In case of ECLAIR you can use
>> various custom api's provided by android to route it to earpiece
>> (google it).You need to set the route explicitly to get the audio out
>> of earpiece or any other place.STREAM_VOICE_CALL will work i think but
>> not 100% sure.Please check in case you are not getting let me know.
>>
>> --
>> 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

Re: [android-developers] Re: Cant get data from my service

2010-01-25 Thread Donal Rafferty
Hi WoodManEXP,

It turned out in the end I just hadn't binded the service properly to the
activity

Like this:

 Intent i = new Intent();
i.setClassName("team.org", "team.org.WIFIService");
bindService(i, this, Context.BIND_AUTO_CREATE);


On Sun, Jan 24, 2010 at 10:51 PM, WoodManEXP  wrote:

> Daffo0,
>
> I would like to know how you solve this because I have a similar need
> with a background service doing a job and the background service would
> like to push updates to an activity (if the activity is running).
>
> What are the preferred communication techniques between Service and
> Activities? You are using IRemoteInterface class. What about IBinder?
> Have you looked at that?
>
>
> On Jan 19, 12:44 pm, "draf...@gmail.com"  wrote:
> > I have aservicethat is running fine and I can see the data
> > collecting in the logcat,
> >
> > However after creating an aidl and trying to get the information from
> > theserviceto my main activity I have hit a problem.
> >
> > I just cant seem to get the data to pass across at all, I always get a
> > null pointer exception.
> >
> > Here is myserviceclass, I want to get the connectedLevel int to use
> > in my activity class.
> >
> > Is it because I'm not binding properly or what am I missing but any
> > calls to the remote interface to try and get the data ends up with a
> > null pointer exception.
> >
> > My activity class code is posted underneath.
> >
> > 
> >
> > Serviceclass
> >
> > public class WIFIService extendsService{
> >
> > private static final int WIFI_NOTIFY = 0x2001;
> > public static final String EXTRA_UPDATE_RATE = "update-rate";
> > public static final String WIFI_SERVICE =
> > "cicero.org.WIFIService.SERVICE";
> >
> > private WifiManager mainWifi;
> > private BroadcastReceiver rssiListener = null;
> >
> > private int updateRate = -1;
> > private int connectedLevel;
> >
> > @Override
> > public void onCreate(){
> > super.onCreate();
> > mainWifi = (WifiManager)
> getSystemService(Context.WIFI_SERVICE);
> > notifier = (NotificationManager) getSystemService
> > (Context.NOTIFICATION_SERVICE);
> >
> > }
> >
> > @Override
> > public void onStart(Intent intent, int startId){
> > super.onStart(intent, startId);
> >
> > updateRate = intent.getIntExtra(EXTRA_UPDATE_RATE, -1);
> > if(updateRate == -1){
> >
> > updateRate = 6;
> >
> > }
> >  rssiListener = new BroadcastReceiver(){
> >
> >  @Override
> >  public void onReceive(Context context, Intent intent) {
> >  String action = intent.getAction();
> >
> >  if(WifiManager.RSSI_CHANGED_ACTION.equals(action))
> > {
> > WifiInfo data = mainWifi.getConnectionInfo();
> > Log.d("WIFISERVICE", "RSSI has changed");
> > if(mainWifi.getConnectionInfo()!=null){
> > setConnectedLevel(data.getRssi());
> > Log.d("WIFISERVICE", "new RSSI = " +
> > data.getSSID()+ " " + data.getRssi() + "dBm");
> > }
> >  }
> >  }
> >  };
> >
> > }
> >
> > @Override
> > public void onDestroy(){
> >
> > if(rssiListener != null){
> > unregisterReceiver(rssiListener);
> > rssiListener = null;
> > }
> >
> > if(wifiChangeListener != null){
> > unregisterReceiver(wifiChangeListener);
> > wifiChangeListener = null;
> > }
> >
> > if(receiverWifi != null){
> > unregisterReceiver(receiverWifi);
> > receiverWifi = null;
> > }
> > super.onDestroy();
> >
> > }
> > public void setConnectedLevel(int connectedLevel) {
> > this.connectedLevel = connectedLevel;
> >
> > }
> >
> > @Override
> > public IBinder onBind(Intent intent) {
> > // we only have one, so no need to check the intent
> > return mRemoteInterfaceBinder;
> > }
> >
> > //  remote interface
> > private final IRemoteInterface.Stub mRemoteInterfaceBinder =
> new
> > IRemoteInterface.Stub() {
> >
> > @Override
> > public int getConnectedLevel() throws
> RemoteException {
> > Log.v("interface", "getConnectedLevel()
> called");
> > return connectedLevel;
> > }
> >
> > };
> >
> > }
> >
> > --

Re: [android-developers] Re: Loop audio from mic to earpiece?

2010-01-25 Thread Donal Rafferty
Hi Ani,

I am working on 1.5 (CupCake) and have tried to use the setRouting method,
however the audio still appears to be coming out of the speaker.

I also have an eclair device and the audio is coming out of the speaker on
that device too.

I have tried using the Audiomanager and the STREAM_VOICE_CALL also but with
no luck at all.

My code is posted above in case I may be using the methods the wrong way?

On Mon, Jan 25, 2010 at 3:09 AM, ani  wrote:

> >Not 100% sure about the earpiece, but you specify a stream when you
> >create the AudioTrack and I think a stream encpsulates audio routing
> >and volume amongst possibly other things.
>
> >If you set the stream to STREAM_VOICE_CALL it might come through the
> >earpiece as this is where a call would be routed, although I guess
> >that depends on headsets and stuff.
> >Can anyone clarify if I am right?
>
> As for earpiece routing we can route audio to earpiece using
> setrouting call in the case of cupcake.In case of ECLAIR you can use
> various custom api's provided by android to route it to earpiece
> (google it).You need to set the route explicitly to get the audio out
> of earpiece or any other place.STREAM_VOICE_CALL will work i think but
> not 100% sure.Please check in case you are not getting let me know.
>
> --
> 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

Re: [android-developers] Re: Loop audio from mic to earpiece?

2010-01-21 Thread Donal Rafferty
Thanks Mike,

Your a legend, have that working now,

I owe you a pint!

Many thanks,
Regards,
Donal

On Thu, Jan 21, 2010 at 5:02 PM, Michael  wrote:

> Hi Donal,
>
> I have pulled together some of my code to form an example. I have no
> idea if this code would compile, but it should be pretty close and
> should serve as an example to get you going.
>
>
>
>android.os.Process.setThreadPriority
> (android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
>
>int buffersize = AudioRecord.getMinBufferSize(11025,
> AudioFormat.CHANNEL_CONFIGURATION_MONO,
> AudioFormat.ENCODING_PCM_16BIT);
>
>AudioRecord arec = new
> AudioRecord(MediaRecorder.AudioSource.MIC,
>11025,
>AudioFormat.CHANNEL_CONFIGURATION_MONO,
>AudioFormat.ENCODING_PCM_16BIT,
>buffersize);
>
>AudioTrack atrack = new
> AudioTrack(AudioManager.STREAM_MUSIC,
>11025,
>AudioFormat.CHANNEL_CONFIGURATION_MONO,
>AudioFormat.ENCODING_PCM_16BIT,
>ba.size(),
>AudioTrack.MODE_STREAMING);
>
>atrack.setPlaybackRate(11025);
>
>byte[] buffer = new byte[buffersize];
>arec.startRecording();
>atrack.play();
>
>while(isRecording) {
>arec.read(buffer, 0, buffersize);
>try {
>atrack.write(buffer, 0, buffer.size());
>} catch (IOException e) {
>
>e.printStackTrace();
>}
>}
>
>arec.stop();
>atrack.stop();
>
> This sets up an AudioRecord and an AudioTrack, tells the one to record
> and the other to play. You then have the while loop which reads the
> data out of the record and writes it to the play. This should
> reproduce the microphone audio as output for you (the code above will
> most likely put it out the speaker, play with the stream in the
> AudioTrack constructor for earpiece).
>
> You will need to run this code on a seperate thread and control the
> lifetime of the thread using the isRecording boolean.
> The first line elevates the thread to a higher priority, this may or
> may not be correct, so you should play with it and see.
> As for your delay, you may need to increase your buffer sizes to hold
> a few seconds worth of data and then just write the data to the
> AudioTrack later to create the delay.
>
> Oh and watch for feedback if the sound does come out of the speaker as
> it can be exponential if it's loud. You can always call:
>
>setVolumeControlStream(AudioManager.STREAM_MUSIC);
>
> from your activity and just make sure you pass the same stream as the
> one you pass to AudioTrack and your volume control will control the
> volume of that stream, enabling you to turn it down ;-)
>
> Hope that helps,
> Mike
>
> On Jan 21, 3:49 pm, Donal Rafferty  wrote:
> > Really sorry to keep annoying you Micheal, head just doesn't seem to be
> > functioning properly today.
> >
> > I currenlty have the AudiRecord buffer set up like this:
> >
> > static final int bufferSize = 8;
> > final short[] buffer = new short[bufferSize];
> > short[] readBuffer = new short[bufferSize];
> >
> > File file = new File(Environment.getExternalStorageDirectory
> >   ().getAbsolutePath() + "/record.pcm");
> >
> > OutputStream os = new FileOutputStream(file);
> >  BufferedOutputStream bos = new BufferedOutputStream(os);
> >  DataOutputStream dos = new DataOutputStream(bos);
> >
> > So that sets up to buffer to the file record.pcm and the
> AudioRecord.read()
> > methos is as follows:
> >
> >  int bufferReadResult = audioRecord.read(readBuffer, 0,bufferSize);
> >
> > for (int i = 0; i < bufferSize; i++)
> > buffer[i] = readBuffer[i];
> > for (int i = 0; i < bufferReadResult; i++)
> >   dos.writeShort(buffer[i]);
> >
> > So it ends up reading to the file that way, so instead of the
> OutputStream
> > os being set
> > to a FileOutputStream do I set it to something else? and then add the
> > OutputStream to
> > a BufferedOutputStream and then that to DaraOutPutStream?
> >
> > Or does buffer[i]

Re: [android-developers] Re: Loop audio from mic to earpiece?

2010-01-21 Thread Donal Rafferty
Really sorry to keep annoying you Micheal, head just doesn't seem to be
functioning properly today.

I currenlty have the AudiRecord buffer set up like this:

static final int bufferSize = 8;
final short[] buffer = new short[bufferSize];
short[] readBuffer = new short[bufferSize];

File file = new File(Environment.getExternalStorageDirectory
  ().getAbsolutePath() + "/record.pcm");

OutputStream os = new FileOutputStream(file);
 BufferedOutputStream bos = new BufferedOutputStream(os);
 DataOutputStream dos = new DataOutputStream(bos);

So that sets up to buffer to the file record.pcm and the AudioRecord.read()
methos is as follows:

 int bufferReadResult = audioRecord.read(readBuffer, 0,bufferSize);

for (int i = 0; i < bufferSize; i++)
buffer[i] = readBuffer[i];
for (int i = 0; i < bufferReadResult; i++)
  dos.writeShort(buffer[i]);

So it ends up reading to the file that way, so instead of the OutputStream
os being set
to a FileOutputStream do I set it to something else? and then add the
OutputStream to
a BufferedOutputStream and then that to DaraOutPutStream?

Or does buffer[i] hold exactly what I need and I just need to get whats in
buffer[i] to
the AudioTrack?

Thanks again and sorry to be so much hassle





On Thu, Jan 21, 2010 at 3:19 PM, Michael  wrote:

> Hi Donal,
>
> Once you have constructed an AudioRecord instance you can call
> startRecording and then you can use the various read methods to pull
> the PCM data out.
> Likewise once you have constructed an AudioTrack and called play you
> can use one of the write methods to push the data you got from
> AudioRecord into the play buffer.
>
> Mike
>
> On Jan 21, 3:12 pm, "draf...@gmail.com"  wrote:
> > Hi Micheal,
> >
> > Thanks again,
> >
> > I now have it recording in PCM format from the mic and saving it to
> > the sd card and then
> > playing it back through the ear piece.
> >
> > So I just have to look into how to into piping the AudioRecord
> > straight into the AuditTrack.
> >
> > So with the AudioRecord instead of creating a file to save to what
> > should I look into doing?
> >
> > And with the AudioTrack, instead of looking for a file to read in what
> > should I look into doing?
> >
> > Thanks,
> > Kind Regards,
> > Donal
> >
> > On Jan 21, 1:10 pm, Michael  wrote:
> >
> > > Hi Donal,
> >
> > > Yeah if you kick the record off and the play, then you can sit in a
> > > loop reading the data out of Record and putting it into play (on a
> > > thread other than the UI thread of course).
> >
> > > Not 100% sure about the earpiece, but you specify a stream when you
> > > create the AudioTrack and I think a stream encpsulates audio routing
> > > and volume amongst possibly other things.
> >
> > > If you set the stream to STREAM_VOICE_CALL it might come through the
> > > earpiece as this is where a call would be routed, although I guess
> > > that depends on headsets and stuff.
> >
> > > Can anyone clarify if I am right?
> >
> > > Mike
> >
> > > On Jan 21, 11:49 am, "draf...@gmail.com"  wrote:
> >
> > > > Hi Mike,
> >
> > > > Thanks for the prompt reply.
> >
> > > > I was looking at the AudioRecord class but had somehow missed the
> > > > AudioTrack class,
> >
> > > > thanks for pointing it out.
> >
> > > > From looking at the classes I think what I have to do is read the
> > > > recording data and put it straight into a streamed
> > > > AudioTrack, would I be correct in saying that?
> >
> > > > And then is it possible to send it to the earpiece?
> >
> > > > Thanks again,
> >
> > > > Donal
> >
> > > > On Jan 21, 11:36 am, Michael  wrote:
> >
> > > > > AudioRecord and AudioTrack are the classes you need.
> >
> > > > > If you use them in streaming mode then you can pipe data out of
> > > > > AudioRecord straight into AudioTrack and you should be able to
> acheive
> > > > > the desired effect.
> >
> > > > > I have done something similar, but without the delay.
> >
> > > > > Mike
> >
> > > > > On Jan 21, 11:28 am, "draf...@gmail.com" 
> wrote:
> >
> > > > > > Hi all,
> >
> > > > > > I was wondering is it possible with Android to record from the
> mic and
> > > > > > play the sound back out the earpiece with just a 1 second delay?
> >
> > > > > > I have seen the tutorials and can currently record from the mike
> and
> > > > > > save a 3gp file to the sd card.
> >
> > > > > > However is it posssible to record and say stream the audio
> straight to
> > > > > > the ear piece with just a 1 - 2 second delay?
> >
> > > > > > If so how would I go about doing this?
> >
> > > > > > Would I need to record from the mic and save it to a file and
> then
> > > > > > repaly to the ear piece? and continually do this?
> >
> > > > > > Or would it be possible to record from the mic and stream it
> directly
> > > > > > to the ear piece with just a slight delay?
> >
> > > > > > Any help, info or directions to tutorials would be greatly
> > > > 

Re: [android-developers] Re: how to enable this permission in my app "com.google.android.providers.gmail.permission.READ_GMAIL"

2010-01-06 Thread Donal Rafferty
I done a bit on authenticating using Google web toolkit about a year ago, it
might be slightly different when doing it through Android but I'd imagine it
would be fairly similiar

you can read about how I authenticated with GWT on my website here -
http://www.riad-donal-rafferty.com/portfolioGWT.html

Be aware that this isn't the most secure way to authenticate.

Also the code isn't formated on the website, you may want to copy and paste
it into an editor

Hope it helps

On Wed, Jan 6, 2010 at 3:17 PM, manoj  wrote:

> hi can you please suggest me how to authenticate?
>
> it would be helpful.
>
> Thanks,
> Manoj.
>
> On Jan 6, 7:47 pm, Donal Rafferty  wrote:
> > You appear to be doing something via Googles Gdata with there gmail, how
> are
> > you accessing the video files?
> >
> > When using gdata you are required to authenthicate, are you doing this?
> >
> > On Wed, Jan 6, 2010 at 2:39 PM, manoj  wrote:
> > > Hi all,
> >
> > > I have written a player application which plays video files (links).
> >
> > > I tested the app on G1. It is working fine, but when I tested the app
> > > on Droid, I got the following log messages.
> >
> > > actually I tried to launch my app when i had a video file as a
> > > attachment. My app launched but not played.
> >
> > > here is the log I got:
> >
> > > 1-06 15:13:40.530: ERROR/DatabaseUtils(1229):
> > > java.lang.SecurityException: Permission Denial: reading
> > > com.google.android.providers.gmail.MailProvider uri
> > > content://gmail-ls/messages/pieter.born%
> > > 40gmail.com/275/attachments/0.0/BEST/false
> > > from pid=1512, uid=10049 requires
> > > com.google.android.providers.gmail.permission.READ_GMAIL
> > > 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> > > android.content.ContentProvider$Transport.enforceReadPermission
> > > (ContentProvider.java:240)
> > > 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> > > android.content.ContentProvider$Transport.openAssetFile
> > > (ContentProvider.java:193)
> > > 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> > > android.content.ContentProviderNative.onTransact
> > > (ContentProviderNative.java:228)
> > > 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> > > android.os.Binder.execTransact(Binder.java:287)
> > > 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> > > dalvik.system.NativeStart.run(Native Method)
> > > 01-06 15:13:40.553: DEBUG/MediaPlayer(1512): Couldn't open file on
> > > client side, trying server side
> > > 01-06 15:13:40.553: DEBUG/ActivityManager(1165):
> > > checkComponentPermission() adjusting {pid,uid} to {1059,1013}
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): Writing exception to
> > > parcel
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229):
> > > java.lang.SecurityException: Permission Denial: reading
> > > com.google.android.providers.gmail.MailProvider uri
> > > content://gmail-ls/messages/pieter.born%
> > > 40gmail.com/275/attachments/0.0/BEST/false
> > > from pid=1165, uid=1000 requires
> > > com.google.android.providers.gmail.permission.READ_GMAIL
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> > > android.content.ContentProvider$Transport.enforceReadPermission
> > > (ContentProvider.java:240)
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> > > android.content.ContentProvider$Transport.openFile
> > > (ContentProvider.java:186)
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> > > android.content.ContentProviderNative.onTransact
> > > (ContentProviderNative.java:209)
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> > > android.os.Binder.execTransact(Binder.java:287)
> > > 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> > > dalvik.system.NativeStart.run(Native Method)
> > > 01-06 15:13:40.561: DEBUG/(1059): openContentUri(content://gmail-ls/
> > > messages/pieter.born%40gmail.com/275/attachments/0.0/BEST/false)
> > > caught exception -1
> > > 01-06 15:13:40.561: ERROR/MediaPlayerService(1059): Couldn't open fd
> > > for content://gmail-ls/messages/pieter.born%
> > > 40gmail.com/275/attachments/0.0/BEST/false
> > > 01-06 
> > > <http://40gmail.com/275/attachments/0.0/BEST/false%0A01-06>15:13:40.569:
> ERROR/MediaPlayer(1512): Unable to to create media
> > > player
> > > 01-06 15:13:40.678: WARN/VideoView(15

Re: [android-developers] how to enable this permission in my app "com.google.android.providers.gmail.permission.READ_GMAIL"

2010-01-06 Thread Donal Rafferty
You appear to be doing something via Googles Gdata with there gmail, how are
you accessing the video files?

When using gdata you are required to authenthicate, are you doing this?

On Wed, Jan 6, 2010 at 2:39 PM, manoj  wrote:

> Hi all,
>
> I have written a player application which plays video files (links).
>
> I tested the app on G1. It is working fine, but when I tested the app
> on Droid, I got the following log messages.
>
> actually I tried to launch my app when i had a video file as a
> attachment. My app launched but not played.
>
> here is the log I got:
>
> 1-06 15:13:40.530: ERROR/DatabaseUtils(1229):
> java.lang.SecurityException: Permission Denial: reading
> com.google.android.providers.gmail.MailProvider uri
> content://gmail-ls/messages/pieter.born%
> 40gmail.com/275/attachments/0.0/BEST/false
> from pid=1512, uid=10049 requires
> com.google.android.providers.gmail.permission.READ_GMAIL
> 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> android.content.ContentProvider$Transport.enforceReadPermission
> (ContentProvider.java:240)
> 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> android.content.ContentProvider$Transport.openAssetFile
> (ContentProvider.java:193)
> 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> android.content.ContentProviderNative.onTransact
> (ContentProviderNative.java:228)
> 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> android.os.Binder.execTransact(Binder.java:287)
> 01-06 15:13:40.530: ERROR/DatabaseUtils(1229): at
> dalvik.system.NativeStart.run(Native Method)
> 01-06 15:13:40.553: DEBUG/MediaPlayer(1512): Couldn't open file on
> client side, trying server side
> 01-06 15:13:40.553: DEBUG/ActivityManager(1165):
> checkComponentPermission() adjusting {pid,uid} to {1059,1013}
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): Writing exception to
> parcel
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229):
> java.lang.SecurityException: Permission Denial: reading
> com.google.android.providers.gmail.MailProvider uri
> content://gmail-ls/messages/pieter.born%
> 40gmail.com/275/attachments/0.0/BEST/false
> from pid=1165, uid=1000 requires
> com.google.android.providers.gmail.permission.READ_GMAIL
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> android.content.ContentProvider$Transport.enforceReadPermission
> (ContentProvider.java:240)
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> android.content.ContentProvider$Transport.openFile
> (ContentProvider.java:186)
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> android.content.ContentProviderNative.onTransact
> (ContentProviderNative.java:209)
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> android.os.Binder.execTransact(Binder.java:287)
> 01-06 15:13:40.553: ERROR/DatabaseUtils(1229): at
> dalvik.system.NativeStart.run(Native Method)
> 01-06 15:13:40.561: DEBUG/(1059): openContentUri(content://gmail-ls/
> messages/pieter.born%40gmail.com/275/attachments/0.0/BEST/false)
> caught exception -1
> 01-06 15:13:40.561: ERROR/MediaPlayerService(1059): Couldn't open fd
> for content://gmail-ls/messages/pieter.born%
> 40gmail.com/275/attachments/0.0/BEST/false
> 01-06 
> 15:13:40.569: 
> ERROR/MediaPlayer(1512): Unable to to create media
> player
> 01-06 15:13:40.678: WARN/VideoView(1512): Unable to open content:
> content://gmail-ls/messages/pieter.born%
> 40gmail.com/275/attachments/0.0/BEST/false
> 01-06 
> 15:13:40.678: 
> WARN/VideoView(1512): java.io.IOException:
> setDataSource failed.: status=0x8000
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.media.MediaPlayer.setDataSource(Native Method)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.media.MediaPlayer.setDataSource(MediaPlayer.java:699)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.widget.VideoView.openVideo(VideoView.java:212)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.widget.VideoView.access$2000(VideoView.java:49)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.widget.VideoView$6.surfaceCreated(VideoView.java:459)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.view.SurfaceView.updateWindow(SurfaceView.java:454)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
> 01-06 15:13:40.678: WARN/VideoView(1512): at android.view.View.draw
> (View.java:6539)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.view.SurfaceView.draw(SurfaceView.java:273)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.view.ViewGroup.drawChild(ViewGroup.java:1526)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
> 01-06 15:13:40.678: WARN/VideoView(1512): at android.view.View.draw
> (View.java:6539)
> 01-06 15:13:40.678: WARN/VideoView(1512): at
> android.view.Vie

Re: [android-developers] Re: Designing a UI for Board Game

2010-01-06 Thread Donal Rafferty
You might find the Heirachy viewer some use as well, you can find in in the
SDK package in the toold folder.

Also in his book "Android wireless application development" Shane Condor
describes how to draw a chessboard as well as working with bitmaps and other
bits and pieces you might find useful, its by no means comprehensive but I
imagine could be a good starting point.


On Wed, Jan 6, 2010 at 10:54 AM, piyushn  wrote:

> you can use DroidDraw tool for gui Design . Check it out @
> www.droiddraw.org
> .
>
>
> thanks;-)
>
>
> On Jan 5, 11:11 am, prakhy  wrote:
> > Hi,
> >
> > I need to design a board UI using android platform. i was planning to
> > take one image as board and moving the required images over the board.
> > How do i achieve the same? I need to find the coordinates for image
> > and need to move the required images to specifies coordinates. Is
> > there any andorid api for this?
> >
> > Prakhy
>
> --
> 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

Re: [android-developers] Send Manual Broadcast

2009-12-23 Thread Donal Rafferty
I presume you have any bluetooth permisiions required in the manifest?

On Wed, Dec 23, 2009 at 9:41 AM, rezar  wrote:

> I created an intend which manually calls BT broadcast receiver as
> follows:
>
> Intent manualIntent = new Intent();
> manualIntent.setAction
> (android.bluetooth.BluetoothDevice.ACTION_FOUND);
> sendBroadcast(manualIntent);
>
> But in Runtime I got the following Exception:
> ERROR/AndroidRuntime(4054): Caused by: java.lang.SecurityException:
> Permission Denial: not allowed to send broadcast
> android.bluetooth.device.action.FOUND from pid=4054, uid=10050
>
> I did not found any appropriate permission to enable me send
> Broadcast. Does any body have the same problem here ?
> I am working on a Droid phone.
>
> --
> 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] Re: Cant find my content provider?

2009-12-22 Thread Donal Rafferty
For anyone that comes across this type of error.

In my infinite graduate wisdom I had the content provider info outside the
application brackets in the xml manifest file!

Wasted a whole day cos of that! [?]

On Tue, Dec 22, 2009 at 9:56 AM, Donal Rafferty  wrote:

> Anybody got any ideas?
>
> I thought I had it figured out with the database but that didn't work.
>
> It seems that either my naming of the CONTENT_URI or something to do with
> that is wrong or else a database/table for the settings never actually gets
> created? if theres no data there for the content provider would I get that
> error?
>
> Or is it actually something to do with the CONTENT_URI?
>
>
> On Mon, Dec 21, 2009 at 3:56 PM, draf...@gmail.com wrote:
>
>> Hi,
>>
>> I have written the following content provider, but when I try to pull
>> information from it into an array, I get the following error:
>>
>> 12-21 15:14:18.627: ERROR/ActivityThread(1160): Failed to find
>> provider info for cicero.org.provider.CiceroContentProvider
>>
>>
>> I presume its something to do with my naming of the CONTENT_URI or
>> something? I'm not quite sure how it works so could anyone explain a
>> bit and spot what I have done wrong?
>>
>> This is what I have in the manifest:
>>
>> XML:
>> >
>> android:authorities="cicero.org.provider.CiceroContentProvider" />
>>
>>
>> Java:
>> public class CiceroContentProvider extends ContentProvider{
>>
>> //URI
>> public static final Uri CONTENT_URI =
>>   Uri.parse("content://
>> cicero.org.provider.CiceroContentProvider");
>>
>> //Underlying database
>>
>> private SQLiteDatabase settingsDB;
>>
>> private static final String TAG = "CiceroProvider";
>> private static final String DATABASE_NAME = "cicero_settings.db";
>> private static final int DATABASE_VERSION = 1;
>> private static final String SETTINGS_TABLE = "settings";
>>
>>
>> //Column names
>> public final static String _ID = "_id";
>> public final static String VOIPUSERNAME = "voipusername";
>> public final static String VOIPAUTHID = "voipauthid";
>> public final static String PASSWORD = "password";
>> public final static String SIPPROXYSERVER = "sipproxyserver";
>> public final static String SIPREGISTRAR = "sipregistrar";
>> public final static String SIPREALM = "siprealm";
>> public final static Integer EXPIRESTIME =30;
>>
>> //column indexes
>> public static final int VOIPUSERNAME_COL = 1;
>> public static final int VOIPAUTHID_COL = 2;
>> public static final int PASSWORD_COL = 3;
>> public static final int SIPPROXYSERVER_COL = 4;
>> public static final int SIPREGISTRAR_COL = 5;
>> public static final int SIPREALM_COL = 6;
>> public static final int EXPIRESTIME_COL = 7;
>>
>> //helper class
>> private static class settingsDatabaseHelper extends
>> SQLiteOpenHelper{
>>
>>  private static final String CREATE_SETTINGS_TABLE
>>  = "CREATE TABLE tbl_settings(" +
>>"_ID INTEGER PRIMARY KEY AUTOINCREMENT," +
>>"VOIPUSERNAME TEXT," +
>>"VOIPAUTHID TEXT," +
>>"PASSWORD TEXT," +
>>"SIPPROXYSERVER TEXT," +
>>"SIPREGISTRAR TEXT," +
>>"SIPREALM TEXT," +
>>"EXPIRESTIME INTEGER);";
>>
>>  public settingsDatabaseHelper(Context context, String name,
>>CursorFactory factory, int version) {
>>   super(context, name, factory, version);
>>
>>  }
>>
>>  @Override
>>  public void onCreate(SQLiteDatabase db) {
>>   db.execSQL(CREATE_SETTINGS_TABLE);
>>
>>  }
>>
>>  @Override
>>  public void onUpgrade(SQLiteDatabase db, int oldVersion, int
>> newVersion) {
>>   Log.w(TAG, "Upgrading database from version " +
>> oldVersion + " to " +
>>  newVersion + ", which will destroy all old
>> data");
>>
>>   db.execSQL("DROP TABLE IF EXISTS " + SETTINGS_TABLE);
>>

[android-developers] Re: Cant find my content provider?

2009-12-22 Thread Donal Rafferty
Anybody got any ideas?

I thought I had it figured out with the database but that didn't work.

It seems that either my naming of the CONTENT_URI or something to do with
that is wrong or else a database/table for the settings never actually gets
created? if theres no data there for the content provider would I get that
error?

Or is it actually something to do with the CONTENT_URI?

On Mon, Dec 21, 2009 at 3:56 PM, draf...@gmail.com wrote:

> Hi,
>
> I have written the following content provider, but when I try to pull
> information from it into an array, I get the following error:
>
> 12-21 15:14:18.627: ERROR/ActivityThread(1160): Failed to find
> provider info for cicero.org.provider.CiceroContentProvider
>
>
> I presume its something to do with my naming of the CONTENT_URI or
> something? I'm not quite sure how it works so could anyone explain a
> bit and spot what I have done wrong?
>
> This is what I have in the manifest:
>
> XML:
> 
> android:authorities="cicero.org.provider.CiceroContentProvider" />
>
>
> Java:
> public class CiceroContentProvider extends ContentProvider{
>
> //URI
> public static final Uri CONTENT_URI =
>   Uri.parse("content://
> cicero.org.provider.CiceroContentProvider");
>
> //Underlying database
>
> private SQLiteDatabase settingsDB;
>
> private static final String TAG = "CiceroProvider";
> private static final String DATABASE_NAME = "cicero_settings.db";
> private static final int DATABASE_VERSION = 1;
> private static final String SETTINGS_TABLE = "settings";
>
>
> //Column names
> public final static String _ID = "_id";
> public final static String VOIPUSERNAME = "voipusername";
> public final static String VOIPAUTHID = "voipauthid";
> public final static String PASSWORD = "password";
> public final static String SIPPROXYSERVER = "sipproxyserver";
> public final static String SIPREGISTRAR = "sipregistrar";
> public final static String SIPREALM = "siprealm";
> public final static Integer EXPIRESTIME =30;
>
> //column indexes
> public static final int VOIPUSERNAME_COL = 1;
> public static final int VOIPAUTHID_COL = 2;
> public static final int PASSWORD_COL = 3;
> public static final int SIPPROXYSERVER_COL = 4;
> public static final int SIPREGISTRAR_COL = 5;
> public static final int SIPREALM_COL = 6;
> public static final int EXPIRESTIME_COL = 7;
>
> //helper class
> private static class settingsDatabaseHelper extends
> SQLiteOpenHelper{
>
>  private static final String CREATE_SETTINGS_TABLE
>  = "CREATE TABLE tbl_settings(" +
>"_ID INTEGER PRIMARY KEY AUTOINCREMENT," +
>"VOIPUSERNAME TEXT," +
>"VOIPAUTHID TEXT," +
>"PASSWORD TEXT," +
>"SIPPROXYSERVER TEXT," +
>"SIPREGISTRAR TEXT," +
>"SIPREALM TEXT," +
>"EXPIRESTIME INTEGER);";
>
>  public settingsDatabaseHelper(Context context, String name,
>CursorFactory factory, int version) {
>   super(context, name, factory, version);
>
>  }
>
>  @Override
>  public void onCreate(SQLiteDatabase db) {
>   db.execSQL(CREATE_SETTINGS_TABLE);
>
>  }
>
>  @Override
>  public void onUpgrade(SQLiteDatabase db, int oldVersion, int
> newVersion) {
>   Log.w(TAG, "Upgrading database from version " +
> oldVersion + " to " +
>  newVersion + ", which will destroy all old
> data");
>
>   db.execSQL("DROP TABLE IF EXISTS " + SETTINGS_TABLE);
>   onCreate(db);
>
>  }
>
> }
>
> //end helper class
>
>
> private static final int SETTINGS = 1;
> private static final int SETTINGS_ID = 2;
>
> private static final UriMatcher uriMatcher;
>
> static{
>  uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
>  uriMatcher.addURI
> ("cicero.org.provider.CiceroContentProvider", "settings", SETTINGS);
>  uriMatcher.addURI
> ("cicero.org.provider.CiceroContentProvider", "settings/#",
> SETTINGS_ID);
> }
>
>
> @Override
> public String getType(Uri uri) {
>  switch(uriMatcher.match(uri)){
>  case SETTINGS:
>   return "vnd.android.cursor.dir/
> vnd.org.CiceroContentProvider";
>  case SETTINGS_ID:
>   return "vnd.android.cursor.item/
> vnd.org.CiceroContentProvider";
>  default:
>   throw new IllegalArgumentException("Unsupported URI: "
> + uri);
>  }
>
> }
>
>
>
> @Override
> public boolean onCreate() {
>  Context context = getContext();
>
>  settingsDatabaseHelper dbHelper;
>  dbHelper = new settingsDatabaseHelper(context,
> DATABASE_NAME, null, DATABASE_VERSION);
>
>  SQLiteDatabase settingsDB = dbHelper.getWritableData

Re: [android-developers] Re: Adding, Editing, Deleting entries in Androids call log

2009-12-17 Thread Donal Rafferty
For anyone that comes across this it is possible to do using the call log
content provider, you simply use the read and write contacts permission and
write to the CallLog.Calls.CONTENT_URI.

On Wed, Dec 16, 2009 at 3:27 PM, Donal Rafferty  wrote:

> I have come across this in the source
>
> ublic static Uri addCall(CallerInfo ci, Context context, String number,
>> int presentation, int callType, long start, int duration)
>> {
>> final ContentResolver resolver = context.getContentResolver();
>>
>> // If this is a private number then set the number to Private,
>> otherwise check
>> // if the number field is empty and set the number to
>> Unavailable
>> if (presentation == Connection.PRESENTATION_RESTRICTED) {
>> number = CallerInfo.PRIVATE_NUMBER;
>> if (ci != null) ci.name = "";
>> } else if (presentation == Connection.PRESENTATION_PAYPHONE) {
>> number = CallerInfo.PAYPHONE_NUMBER;
>> if (ci != null) ci.name = "";
>> } else if (TextUtils.isEmpty(number)
>> || presentation == Connection.PRESENTATION_UNKNOWN) {
>> number = CallerInfo.UNKNOWN_NUMBER;
>> if (ci != null) ci.name = "";
>> }
>>
>> ContentValues values = new ContentValues(5);
>>
>> values.put(NUMBER, number);
>> values.put(TYPE, Integer.valueOf(callType));
>> values.put(DATE, Long.valueOf(start));
>> values.put(DURATION, Long.valueOf(duration));
>> values.put(NEW, Integer.valueOf(1));
>> if (ci != null) {
>> values.put(CACHED_NAME, ci.name);
>> values.put(CACHED_NUMBER_TYPE, ci.numberType);
>> values.put(CACHED_NUMBER_LABEL, ci.numberLabel);
>> }
>>
>> if ((ci != null) && (ci.person_id > 0)) {
>> ContactsContract.Contacts.markAsContacted(resolver,
>> ci.person_id);
>> }
>>
>>     Uri result = resolver.insert(CONTENT_URI, values);
>>
>> removeExpiredEntries(context);
>>
>> return result;
>> }
>>
>
> Could I use this in some way and how do I go about it?
>
> Thanks,
>
> Donal
>
> On Wed, Dec 16, 2009 at 11:02 AM, Donal Rafferty wrote:
>
>> Hi Kumar,
>>
>> The idea is to show calls made over wi fi or 3G from another application
>> in the Call Log as if they were made over GSM.
>>
>> You reckon looking at the source will be the only way?
>>
>> Thanks,
>>
>> Donal
>>
>>
>> On Wed, Dec 16, 2009 at 10:33 AM, Kumar Bibek wrote:
>>
>>> Hi Donal,
>>>
>>> This is as good as hacking. I guess, adding a new call log should not
>>> be possible. However, deleting them should be possible by using the
>>> Content Provider.
>>>
>>> You need to re-read the documentations, or may be look at the source
>>> codes.
>>>
>>> Kumar Bibek
>>> http://tech-droid.blogspot.com
>>>
>>> On Dec 15, 5:57 pm, Donal Rafferty  wrote:
>>> > Here is the code I have
>>> >
>>> > import android.app.Activity;
>>> >
>>> >
>>> >
>>> > > import android.content.ContentUris;
>>> > > import android.content.ContentValues;
>>> > > import android.content.Context;
>>> > > import android.database.Cursor;
>>> > > import android.net.Uri;
>>> > > import android.os.Bundle;
>>> > > import android.provider.CallLog;
>>> > > import android.util.Log;
>>> > > import android.widget.SimpleCursorAdapter;
>>> >
>>> > > public class test extends Activity {
>>> > > /** Called when the activity is first created. */
>>> > > @Override
>>> > > public void onCreate(Bundle savedInstanceState) {
>>> > > super.onCreate(savedInstanceState);
>>> > > setContentView(R.layout.main);
>>> >
>>> > > Uri myCall =
>>> ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI,
>>> > > 0);
>>> >
>>> > > Cursor cur = managedQuery(myCall, null, null, null, null);
>>> >
>>> > > String[] projection = new

Re: [android-developers] Re: Adding, Editing, Deleting entries in Androids call log

2009-12-16 Thread Donal Rafferty
I have come across this in the source

ublic static Uri addCall(CallerInfo ci, Context context, String number,
> int presentation, int callType, long start, int duration) {
> final ContentResolver resolver = context.getContentResolver();
>
> // If this is a private number then set the number to Private,
> otherwise check
> // if the number field is empty and set the number to
> Unavailable
> if (presentation == Connection.PRESENTATION_RESTRICTED) {
> number = CallerInfo.PRIVATE_NUMBER;
> if (ci != null) ci.name = "";
> } else if (presentation == Connection.PRESENTATION_PAYPHONE) {
> number = CallerInfo.PAYPHONE_NUMBER;
> if (ci != null) ci.name = "";
> } else if (TextUtils.isEmpty(number)
> || presentation == Connection.PRESENTATION_UNKNOWN) {
> number = CallerInfo.UNKNOWN_NUMBER;
> if (ci != null) ci.name = "";
> }
>
> ContentValues values = new ContentValues(5);
>
> values.put(NUMBER, number);
> values.put(TYPE, Integer.valueOf(callType));
> values.put(DATE, Long.valueOf(start));
> values.put(DURATION, Long.valueOf(duration));
> values.put(NEW, Integer.valueOf(1));
> if (ci != null) {
> values.put(CACHED_NAME, ci.name);
> values.put(CACHED_NUMBER_TYPE, ci.numberType);
> values.put(CACHED_NUMBER_LABEL, ci.numberLabel);
> }
>
> if ((ci != null) && (ci.person_id > 0)) {
> ContactsContract.Contacts.markAsContacted(resolver,
> ci.person_id);
> }
>
> Uri result = resolver.insert(CONTENT_URI, values);
>
> removeExpiredEntries(context);
>
> return result;
> }
>

Could I use this in some way and how do I go about it?

Thanks,

Donal

On Wed, Dec 16, 2009 at 11:02 AM, Donal Rafferty  wrote:

> Hi Kumar,
>
> The idea is to show calls made over wi fi or 3G from another application in
> the Call Log as if they were made over GSM.
>
> You reckon looking at the source will be the only way?
>
> Thanks,
>
> Donal
>
>
> On Wed, Dec 16, 2009 at 10:33 AM, Kumar Bibek wrote:
>
>> Hi Donal,
>>
>> This is as good as hacking. I guess, adding a new call log should not
>> be possible. However, deleting them should be possible by using the
>> Content Provider.
>>
>> You need to re-read the documentations, or may be look at the source
>> codes.
>>
>> Kumar Bibek
>> http://tech-droid.blogspot.com
>>
>> On Dec 15, 5:57 pm, Donal Rafferty  wrote:
>> > Here is the code I have
>> >
>> > import android.app.Activity;
>> >
>> >
>> >
>> > > import android.content.ContentUris;
>> > > import android.content.ContentValues;
>> > > import android.content.Context;
>> > > import android.database.Cursor;
>> > > import android.net.Uri;
>> > > import android.os.Bundle;
>> > > import android.provider.CallLog;
>> > > import android.util.Log;
>> > > import android.widget.SimpleCursorAdapter;
>> >
>> > > public class test extends Activity {
>> > > /** Called when the activity is first created. */
>> > > @Override
>> > > public void onCreate(Bundle savedInstanceState) {
>> > > super.onCreate(savedInstanceState);
>> > > setContentView(R.layout.main);
>> >
>> > > Uri myCall =
>> ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI,
>> > > 0);
>> >
>> > > Cursor cur = managedQuery(myCall, null, null, null, null);
>> >
>> > > String[] projection = new String[] {
>> > > CallLog.Calls.CACHED_NAME,
>> > > CallLog.Calls.CACHED_NUMBER_LABEL,
>> > > CallLog.Calls.DURATION
>> > >  };
>> >
>> > > Uri myCalls = CallLog.Calls.CONTENT_URI;
>> >
>> > > Cursor managedCursor = managedQuery(myCalls,
>> > > projection, // Which columns to return
>> > > null,   // Which rows to return (all rows)
>> > > null,   // Selection arguments (none)
>> > > // Put the results in ascending order b

Re: [android-developers] Re: Adding, Editing, Deleting entries in Androids call log

2009-12-16 Thread Donal Rafferty
Hi Kumar,

The idea is to show calls made over wi fi or 3G from another application in
the Call Log as if they were made over GSM.

You reckon looking at the source will be the only way?

Thanks,

Donal

On Wed, Dec 16, 2009 at 10:33 AM, Kumar Bibek  wrote:

> Hi Donal,
>
> This is as good as hacking. I guess, adding a new call log should not
> be possible. However, deleting them should be possible by using the
> Content Provider.
>
> You need to re-read the documentations, or may be look at the source
> codes.
>
> Kumar Bibek
> http://tech-droid.blogspot.com
>
> On Dec 15, 5:57 pm, Donal Rafferty  wrote:
> > Here is the code I have
> >
> > import android.app.Activity;
> >
> >
> >
> > > import android.content.ContentUris;
> > > import android.content.ContentValues;
> > > import android.content.Context;
> > > import android.database.Cursor;
> > > import android.net.Uri;
> > > import android.os.Bundle;
> > > import android.provider.CallLog;
> > > import android.util.Log;
> > > import android.widget.SimpleCursorAdapter;
> >
> > > public class test extends Activity {
> > > /** Called when the activity is first created. */
> > > @Override
> > > public void onCreate(Bundle savedInstanceState) {
> > > super.onCreate(savedInstanceState);
> > > setContentView(R.layout.main);
> >
> > > Uri myCall =
> ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI,
> > > 0);
> >
> > > Cursor cur = managedQuery(myCall, null, null, null, null);
> >
> > > String[] projection = new String[] {
> > > CallLog.Calls.CACHED_NAME,
> > > CallLog.Calls.CACHED_NUMBER_LABEL,
> > > CallLog.Calls.DURATION
> > >  };
> >
> > > Uri myCalls = CallLog.Calls.CONTENT_URI;
> >
> > > Cursor managedCursor = managedQuery(myCalls,
> > > projection, // Which columns to return
> > > null,   // Which rows to return (all rows)
> > > null,   // Selection arguments (none)
> > > // Put the results in ascending order by name
> > > CallLog.Calls.DATE + " ASC");
> > > this.addToCallLog();
> > > this.getColumnData(managedCursor);
> > > }
> >
> > > private void getColumnData(Cursor cur){
> > > if (cur.moveToFirst()) {
> >
> > > String name;
> > > String phoneNumber;
> > > String duration;
> > > int nameColumn =
> cur.getColumnIndex(CallLog.Calls.CACHED_NAME);
> > > int phoneColumn =
> > > cur.getColumnIndex(CallLog.Calls.CACHED_NUMBER_LABEL);
> > > int durationColumn =
> > > cur.getColumnIndex(CallLog.Calls.DURATION);
> > > String imagePath;
> >
> > > do {
> > > // Get the field values
> > > name = cur.getString(nameColumn);
> > > phoneNumber = cur.getString(phoneColumn);
> > > duration = cur.getString(durationColumn);
> >
> > >//Log.i("NAMES ! = ", name);
> > >// Log.i("Number ! = ", phoneNumber);
> > > Log.i("duration ! = ", duration);
> >
> > > } while (cur.moveToNext());
> >
> > > }
> >
> > > }
> >
> > > private void addToCallLog(){
> >
> > > ContentValues values = new ContentValues();
> >
> > > // Add Abraham Lincoln to Calls List;
> > > values.put(CallLog.Calls.CACHED_NAME, "Abraham Lincoln2");
> > > //values.put(CallLog.Calls.CACHED_NUMBER_LABEL, "0863497543");
> > > values.put(CallLog.Calls.DURATION, 102);
> >
> > > Uri uri =
> getContentResolver().insert(CallLog.Calls.CONTENT_URI,
> > > values);
> >
> > > }
> >
> > > }
> >
> > This works in that the logcat shows that its adding the duration, however
> > problems include:
> >
> > Not getting the phonenumber, this gives a uncaughtexception error
> >
> > And the emulator crashes the Call Log app thats already on the device
> when
> > it is used after my app has run
> >
> > On Tue, 

[android-developers] Re: Adding, Editing, Deleting entries in Androids call log

2009-12-15 Thread Donal Rafferty
Here is the code I have



import android.app.Activity;
> import android.content.ContentUris;
> import android.content.ContentValues;
> import android.content.Context;
> import android.database.Cursor;
> import android.net.Uri;
> import android.os.Bundle;
> import android.provider.CallLog;
> import android.util.Log;
> import android.widget.SimpleCursorAdapter;
>
>
> public class test extends Activity {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
>
> Uri myCall = ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI,
> 0);
>
> Cursor cur = managedQuery(myCall, null, null, null, null);
>
> String[] projection = new String[] {
> CallLog.Calls.CACHED_NAME,
> CallLog.Calls.CACHED_NUMBER_LABEL,
> CallLog.Calls.DURATION
>  };
>
> Uri myCalls = CallLog.Calls.CONTENT_URI;
>
> Cursor managedCursor = managedQuery(myCalls,
> projection, // Which columns to return
> null,   // Which rows to return (all rows)
> null,   // Selection arguments (none)
> // Put the results in ascending order by name
> CallLog.Calls.DATE + " ASC");
> this.addToCallLog();
> this.getColumnData(managedCursor);
> }
>
>
> private void getColumnData(Cursor cur){
> if (cur.moveToFirst()) {
>
> String name;
> String phoneNumber;
> String duration;
> int nameColumn = cur.getColumnIndex(CallLog.Calls.CACHED_NAME);
> int phoneColumn =
> cur.getColumnIndex(CallLog.Calls.CACHED_NUMBER_LABEL);
> int durationColumn =
> cur.getColumnIndex(CallLog.Calls.DURATION);
> String imagePath;
>
> do {
> // Get the field values
> name = cur.getString(nameColumn);
> phoneNumber = cur.getString(phoneColumn);
> duration = cur.getString(durationColumn);
>
>//Log.i("NAMES ! = ", name);
>// Log.i("Number ! = ", phoneNumber);
> Log.i("duration ! = ", duration);
>
>
> } while (cur.moveToNext());
>
> }
>
> }
>
> private void addToCallLog(){
>
> ContentValues values = new ContentValues();
>
> // Add Abraham Lincoln to Calls List;
> values.put(CallLog.Calls.CACHED_NAME, "Abraham Lincoln2");
> //values.put(CallLog.Calls.CACHED_NUMBER_LABEL, "0863497543");
> values.put(CallLog.Calls.DURATION, 102);
>
> Uri uri = getContentResolver().insert(CallLog.Calls.CONTENT_URI,
> values);
>
>
> }
>
> }
>


This works in that the logcat shows that its adding the duration, however
problems include:

Not getting the phonenumber, this gives a uncaughtexception error

And the emulator crashes the Call Log app thats already on the device when
it is used after my app has run




On Tue, Dec 15, 2009 at 12:22 PM, draf...@gmail.com wrote:

> Hi,
>
> I have been looking at Androids call log content provider and have
> managed to pull the data from it and display it in my own app.
>
> However I want to be able to write to the call log, is there anyway of
> doing this?

-- 
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