I'm not quite up for it tonight, but this really deserves a good rant.

All of what you say here is true. But Android-the-platform (not
Android-the-OS) is really missing out here, failing to fully and
effectively leverage a KEY FEATURE of Android -- the use of intents
and content providers to integrate.

The mechanism is there, to do whatever you want -- but you can't do
it, simply because there is NO STANDARD.

Sure, you may not have email provider Y instead of X.

But all that's needed here is agreement as to how email notifications
are to be provided. The simplest way would be to broadcast an intent,
and document this intent. Then when I write my super-duper email
program -- I also send the same broadcast.

The only differences:

* I indicate that I am the sender of the intent (this information
really ought to be inherent in sending an intent!). Indicating the
sending component enables various policies -- for example, ignoring a
broadcasting app the user does NOT an app to respond to -- or ignoring
one's own broadcasts.

* I supply a PendingIntent for invoking my own app to view the email,
rather than whatever was delivered on the platform.

* If my security policies allow it, I supply a content URI. (I can't
think of a security policy under which I'd consider this a good idea
for email, but maybe you can -- in any event, consider it an optional
part of the overall paradigm)

This doesn't take a whole lot of design, or a whole lot of code. It
simply involves having enough WILLPOWER to make a few decisions, and
communicate them.

(And it's not just Android that needs to be making such decisions. We
really need all app developers who provide significant functionality
to provide this sort of openness. Say, a task manager that broadcasts
that a task has been created, being picked up by a reminder app that
flashes your trackball when you have a task.)

Really, I think this sort of thing, across the board, is really the
missing Apple Killer. This is what makes the Android platform have so
much more potential, in my mind, than the iPhone -- and yet, it seems
to be SADLY neglected. Android-the-platform could be vastly more
powerful -- without a single line of platform code.

I really should write a good rant on the topic when I have a bit more
time.

On Jan 6, 5:29 am, Mark Murphy <[email protected]> wrote:
> On Thu, Jan 6, 2011 at 2:18 AM, Warren <[email protected]> wrote:
> > First, I want to get the new mail notification
>
> There is no "new mail notification" in Android, because "mail" is not
> in Android. "Mail" is an application concept, not an OS concept.
>
> > I used
> > getContentResolver().registerContentObserver(Uri.parse"content://
> > com.android.email.provider"), true, service)
>
> This assumes:
>
> -- That application exists
> -- That application has not been modified
> -- That application is what the user is using
>
> None of those are safe assumptions. That is why this is not part of
> the Android SDK.
>
> > Then, i want to get this new mail content
> > I used
> > final String URI = "content://com.android.email.provider/message";
>
> See the above list of assumptions.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 2.3 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to