onNewIntent() is never called when use Icons

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

onNewIntent() is never called when use Icons

Postby joaosauer » Mon Nov 16, 2009 12:08 pm

Hi,

What I'm trying to do was supposed to be very simple, but is not working. :)
I would like to have 2 Icons that will call my activity, that is the only one in the package.
But, when the activity is called, I would like to know which of these Icons was used.
In the logs, I'm able to see that the Intent sent asap after press the icon is sending this message like:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. I(  569:0x23d) Starting activity: Intent { action=android.intent.action.MAIN categories= {android.intent.category.LAUNCHER} flags=0x10200000 comp={teste.teste/teste.teste.alias1} }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But, my override of onNewIntent is never called and the onResume is receiving a modified version of the Intent:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. D(  896:0x380) Intent is Intent { action=android.intent.action.MAIN categories={android.intent.category.LAUNCHER} flags=0x10200000 comp= {teste.teste/teste.teste.mainapp} }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


As you can see, the alias1 packagename was modified to mainapp. And because of this, I'm unable to check which button was applied.

My code in the manifest file is simple:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <application  android:icon="@drawable/icon"  android:label="@string/app_name" android:debuggable="true"  >
  2.  
  3.            <activity android:name=".mainapp" android:label="@string/app_name" android:configChanges="orientation" android:launchMode="singleTop">
  4.  
  5.                        <intent-filter>
  6.  
  7.                                <action android:name="android.intent.action.MAIN" />
  8.  
  9.                        </intent-filter>
  10.  
  11.                </activity>
  12.  
  13.                <activity-alias android:name="alias1" android:label="alias1" android:icon="@drawable/icon" android:targetActivity=".mainapp" android:launchMode="singleTop" >
  14.  
  15.                        <intent-filter>
  16.  
  17.                                <action android:name="android.intent.action.MAIN" />
  18.  
  19.                                <category android:name="android.intent.category.LAUNCHER" />
  20.  
  21.                        </intent-filter>
  22.  
  23.                </activity-alias>
  24.  
  25.                <activity-alias android:name="alias2" android:label="alias2" android:icon="@drawable/icon" android:targetActivity=".mainapp" android:launchMode="singleTop">
  26.  
  27.                        <intent-filter>
  28.  
  29.                                <action android:name="android.intent.action.MAIN" />
  30.  
  31.                                <category android:name="android.intent.category.LAUNCHER" />
  32.  
  33.                        </intent-filter>
  34.  
  35.                </activity-alias>
  36.  
  37.                <receiver android:name=".BootMainapp">
  38.  
  39.                        <intent-filter>
  40.  
  41.                                <action android:name="android.intent.action.BOOT_COMPLETED" />
  42.  
  43.                                <category android:name="android.intent.category.HOME" />
  44.  
  45.                        </intent-filter>
  46.  
  47.                </receiver>
  48.  
  49.        </application>
  50.  
  51.  
Parsed in 0.006 seconds, using GeSHi 1.0.8.4

As you can see, I'm using the singleTop definition, as a requirement for onNewIntent call.

Any ideas what could be wrong here? Or, How can I have a way to check which Icon was used to call my Acitivity?

Thank you,
Joao Sauer
joaosauer
Freshman
Freshman
 
Posts: 2
Joined: Mon Nov 16, 2009 12:03 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot], Google Feedfetcher and 4 guests