Re: [android-developers] Different AlarmClock applications for every phone?

2010-03-11 Thread Thomas Ermesjo
>Now, if you want to allow the user to choose an application to launch,
>by pulling up a list of available activities from the PackageManager,
>that's perfectly reasonable.

Thanks. Good idea.


2010/3/11 Mark Murphy 

> Thomas Ermesjo wrote:
> > So anyone with a Nexus One can check their logcat to see what the
> > Alarmclock classname for the nexus is?
>
> You should not be doing this. The alarm clock is an application, not
> part of the SDK.
>
> http://www.androidguys.com/2009/12/14/code-pollution-reaching-past-the-sdk/
>
> Some applications that may exist on Android have publicly documented
> Intents, such as:
>
> http://developer.android.com/uide/appendix/g-app-intents.html
>
> The alarm clock is not one of them.
>
> Now, if you want to allow the user to choose an application to launch,
> by pulling up a list of available activities from the PackageManager,
> that's perfectly reasonable.
>
> But please don't go around hard-wiring class names in your code.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | 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

Re: [android-developers] Different AlarmClock applications for every phone?

2010-03-11 Thread Mark Murphy
Thomas Ermesjo wrote:
> So anyone with a Nexus One can check their logcat to see what the
> Alarmclock classname for the nexus is?

You should not be doing this. The alarm clock is an application, not
part of the SDK.

http://www.androidguys.com/2009/12/14/code-pollution-reaching-past-the-sdk/

Some applications that may exist on Android have publicly documented
Intents, such as:

http://developer.android.com/uide/appendix/g-app-intents.html

The alarm clock is not one of them.

Now, if you want to allow the user to choose an application to launch,
by pulling up a list of available activities from the PackageManager,
that's perfectly reasonable.

But please don't go around hard-wiring class names in your code.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | 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


Re: [android-developers] Different AlarmClock applications for every phone?

2010-03-11 Thread Thomas Ermesjo
So anyone with a Nexus One can check their logcat to see what the Alarmclock
classname for the nexus is?

Thomas

2010/3/11 Dianne Hackborn 

> There is no standard alarm clock API in the platform.  Heck, some devices
> may not even have one.
>
>
> On Thu, Mar 11, 2010 at 12:23 AM, Thomas  wrote:
>
>> I have a widget that should launch the AlarmClock when its clicked.
>> After searching for a result it seems to me that every phone can have
>> its own AlarmClock-application, and that what I am trying to do isnt
>> really possible?
>>
>> I have been using this for HTC Hero:
>> i.setClassName("com.htc.android.worldclock",
>> "com.htc.android.worldclock.WorldClockTabControl");
>> resolved = packageManager.resolveActivity(i,
>> PackageManager.MATCH_DEFAULT_ONLY);
>>
>> And this if not HTC Hero:
>> i.setClassName("com.android.alarmclock",
>> "com.android.alarmclock.AlarmClock");
>> resolved = packageManager.resolveActivity(i,
>> PackageManager.MATCH_DEFAULT_ONLY);
>>
>> This way I can check if the AlarmClock application is there. But now
>> it seems that the Nexus One has yet another application. Does anyone
>> know the component name and class for the Nexus AlarmClock?
>>
>> I can see that this will be a growing list of checks, so is there a
>> better way?
>>
>> Thomas
>>
>> --
>> 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] Different AlarmClock applications for every phone?

2010-03-11 Thread Dianne Hackborn
There is no standard alarm clock API in the platform.  Heck, some devices
may not even have one.

On Thu, Mar 11, 2010 at 12:23 AM, Thomas  wrote:

> I have a widget that should launch the AlarmClock when its clicked.
> After searching for a result it seems to me that every phone can have
> its own AlarmClock-application, and that what I am trying to do isnt
> really possible?
>
> I have been using this for HTC Hero:
> i.setClassName("com.htc.android.worldclock",
> "com.htc.android.worldclock.WorldClockTabControl");
> resolved = packageManager.resolveActivity(i,
> PackageManager.MATCH_DEFAULT_ONLY);
>
> And this if not HTC Hero:
> i.setClassName("com.android.alarmclock",
> "com.android.alarmclock.AlarmClock");
> resolved = packageManager.resolveActivity(i,
> PackageManager.MATCH_DEFAULT_ONLY);
>
> This way I can check if the AlarmClock application is there. But now
> it seems that the Nexus One has yet another application. Does anyone
> know the component name and class for the Nexus AlarmClock?
>
> I can see that this will be a growing list of checks, so is there a
> better way?
>
> Thomas
>
> --
> 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