1. Try adding the FLAG_ACTIVITY_NEW_TASK flag to your intent as the
   error suggested.
   2. Try contacting Urban Airship if you have more problems.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Mar 12, 2012 at 3:57 AM, vani reddy <[email protected]>wrote:

>
>
>
>
> Hi friends,
>
> I am using Urbanairship for push notifications.
>
> I am getting the following exception
>
> Unable to start receiver com.testdemo.android.IntentReceiver: 
> android.util.AndroidRuntimeException: Calling startActivity() from outside of 
> an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really 
> what you want?
>
>
>
> and the below is the onReceive of IntentReceiver
>
>
>       @Override
>       public void onReceive(Context arg0, Intent aIntent) {
>               String action = aIntent.getAction();
>               if (action.equals(PushManager.ACTION_NOTIFICATION_OPENED)) {
>                       // user opened the notification so we launch the 
> application
>
>                       // This intent is what will be used to launch the 
> activity in our
>                       // application
>                       Intent lLaunch = new Intent(Intent.ACTION_MAIN);
>
>                       // Main.class can be substituted any activity in your 
> android
>                       // project that you wish
>                       // to be launched when the user selects the 
> notification from the
>                       // Notifications drop down
>                       
> lLaunch.setClass(UAirship.shared().getApplicationContext(),
>                                       HomeScreen.class);
>                       
>                       
> lLaunch.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
>
>                       // copy the intent data from the incoming intent to the 
> intent
>                       // that we are going to launch
>                       
> //                    copyIntentData(aIntent, lLaunch);
>
>                       
> UAirship.shared().getApplicationContext().startActivity(lLaunch);
>
>               } else if (action.equals(PushManager.ACTION_PUSH_RECEIVED)) {
>                       // push notification received, perhaps store it in a db
>
>                       
>               }
>               
>               
>       }
>
>
> Please reply ....
>
>
> --
>
>
>
>
> --
> Regards,
> Vani Reddy
>
>  --
> 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
>

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