Nevermind...it was a /stupid/ mistake.
The PendingIntent I was supplying was fetched from
PendingIntent.getActivity() where as it should have been called with
PendingIntent.getBroadcast().
It works fine now :-)
On Aug 28, 2:43 pm, woodm <[EMAIL PROTECTED]> wrote:
> Thanks for getting back to me so quickly.
>
> I've altered my code to define my own intent
> (<package_name>.action.PROXIMITY_ALERT). However, doing this simply
> yielded the same results. I also added the following line:
>
> proxIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>
> prior to creating the PendingIntent. I then modified my Manifest,
> adding an IntentFilter for the main activity:
>
> <activity android:name=".BuddyList" android:label="@string/app_name">
> <intent-filter>
> <action android:name="android.intent.action.MAIN" />
> <category android:name="android.intent.category.LAUNCHER" />
> </intent-filter>
> <intent-filter>
> <action android:name="<package_name>.action.PROXIMITY_ALERT" />
> <category android:name="android.intent.category.DEFAULT" />
> </intent-filter>
> </activity>
>
> However, for some reason, when I do this, I get the following in
> LogCat:
>
> 08-28 13:24:19.974: INFO/LocationManagerService(53): Entered alert
> 08-28 13:24:19.983: INFO/ActivityManager(53): Starting activity:
> Intent { action=<package_name>.action.PROXIMITY_ALERT
> comp={<package_name>/<package_name>.BuddyList} (has extras) }
> 08-28 13:24:20.004: WARN/ActivityManager(53): startActivity called
> from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for:
> Intent { action=<package_name>.action.PROXIMITY_ALERT
> comp={<package_name>/<package_name>.BuddyList} (has extras) }
>
> Notice the final line -- despite me adding the new flags to my intent
> mentioned above. This causes the application to loop and start itself
> over and over and over and then in the end breaking.
>
> The BroadcastReceiver definitely works -- I've tried inserting the
> line sendBroadcast(proxIntent) and the receiver does get the messages
> and prints to LogCat as expected.
>
> Could this be a bug with the proximity alerts functionality? Has
> anyone else got proximity alerts working correctly?
>
> Cheers
>
> On Aug 28, 12:47 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
>
> > woodm wrote:
> > > Actually. after having a closer look at the Intent documentation does
> > > PROXIMITY_ALERT even exist anymore!?
>
> > There's nothing to say you need to use their namespace for your action.
> > In fact, I'm under the impression you should use your own namespace, to
> > prevent potential collisions with other apps.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Warescription: All titles, revisions, & ebook formats, just $35/year
>
>
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---