Yes I had this kind of problem with Eclipse until a few days.
But now I changed my manifest and the intent flags in my notification
intents:
My main activity is still singleTop to avoid multiple instances when
relaunching from Home, onNewIntent is called.
In notifications intents I use both the flags NEW_TASK and
CLEAR_ON_TOP: the onNewIntent is called.
It seems to work every time now, even if I relaunch from Eclipse.
On Aug 29, 12:31 pm, Yalcin <[EMAIL PROTECTED]> wrote:
> Look at the discussion under the topic "Activity Question" couple days
> ago
>
> webmonkey wrote: 27. August 2008 20:25
>
> ---------------------------
>
> there is no need to use singleTask, singleTop or any
> other special flags. It has something to do with the way Eclipse re-
> installs your application. If you run without using Eclipse everything
> should work fine. I do the following to get the correct behaviour:
>
> 1. I run my app in Eclipse using Run > Run History > myApp. The app
> opens up with the home activity
> 2. I hit the Back button. The Android home screen with the app menu is
> displayed
> 3. I start my app from the Android app menu. The app opens up with the
> home activity
> 4. From now on, it will work as expected so when I press Home in a
> 'secondary' activity and then restart my App again from the Android
> app menu it will go back to the 'secondary' activity.
>
> ---
>
> On Aug 29, 12:09 pm, Guillaume Perrot <[EMAIL PROTECTED]>
> wrote:
>
> > about onRestoreSavedInstanceState: I misunderstood the doc, I now
> > understand why it was not called in my case. Sorry.
>
> > about onNewIntent:
> > In fact there is a very strange problem: if I launch my application
> > from Eclipse, the mechanism will not work, but if I shutdown my
> > emulator then relauch emulator then my application it works...
> > Here is a simplified test app which illustrates the mechanism of
> > relaunching my app with a "command" from the notification bar. This
> > application always works, strangely, the mechanism is exactly the same
> > in my real application...
>
> > public class Test extends Activity
> > {
> > @Override
> > public void onCreate(Bundle savedInstanceState)
> > {
> > Log.d("test", "onCreate(savedInstanceState=" + savedInstanceState
> > + ")");
> > super.onCreate(savedInstanceState);
> > setContentView(R.layout.main);
>
> > displayIntentExtras();
>
> > Intent intent = new Intent(this, Test.class);
> > //intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
> > intent.putExtra("dummy", "dummy");
> > Notification notification = new Notification(R.drawable.icon,
> > "relaunch with dummy extra", System.currentTimeMillis());
> > notification.setLatestEventInfo(this, "relaunch app",
> > "relaunch with dummy extra", PendingIntent
> > .getActivity(this, 0, intent, 0));
>
> > NotificationManager notificationManager = (NotificationManager)
> > getSystemService(Context.NOTIFICATION_SERVICE);
> > notificationManager.notify(1, notification);
> > }
>
> > private void displayIntentExtras()
> > {
> > Log.d("test", "dummy=" + getIntent().getStringExtra("dummy"));
> > }
>
> > @Override
> > protected void onStart()
> > {
> > Log.d("test", "onStart()");
> > super.onStart();
> > }
>
> > @Override
> > protected void onRestart()
> > {
> > Log.d("test", "onRestart()");
> > super.onRestart();
> > }
>
> > @Override
> > protected void onNewIntent(Intent intent)
> > {
> > Log.d("test", "onNewIntent(intent=" + intent + ")");
> > setIntent(intent);
> > displayIntentExtras();
> > super.onNewIntent(intent);
> > }
>
> > }
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> > package="test.test">
> > <application android:icon="@drawable/icon" android:label="@string/
> > app_name">
> > <activity android:name=".Test" android:label="@string/
> > app_name" android:launchMode="singleTop">
> > <intent-filter>
> > <action android:name="android.intent.action.MAIN" />
> > <category
> > android:name="android.intent.category.LAUNCHER" />
> > </intent-filter>
> > </activity>
> > </application>
> > </manifest>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---