Edit / Update:
As an update to the below problem, I found the exact action which causes it to happen.
Download an apk from a url through the android browser
Install the app.
After install, the app gives you two choices: "Open" or "Done".
If you choose "Open", the quirky behavior described below starts.
If you choose "Done", then launch the app from the app tray, it works fine.
So it seems like this problem is caused by using the "Open" button the browser provides you after installing the APK.
I'm experiencing an error in the history stack of applications upon first install. I made a test app to demonstrate this.
The test app is simply two activities, A and B. Activity A launches B. That's all it does. Rest is wizard generated template code from eclipse.
When the user installs the app (via web url apk), and runs it for the first time, I get an out-of-order activity stack:
User starts the app, A is on top.
They make A launch B by clicking a button. B is on top of the stack.
User hits the home screen button.
User returns to the app, A is displayed, instead of B.
User hits the back key, B is shown!
User hits the back key again, A is shown!
User hits the back key again, home screen shown.
Now the stack is clean, and app behaves "normally" from now on!
Is any one else seeing this? This is almost exactly like this known bug, however my users are not installing from eclipse:
link.
I can provide the test app/source if anyone wants to try. This is the manifest, which does not have any special customizations made to it.
<activity android:name=".ActivityA"
android:label="ActivityA">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="ActivityB"
android:label="ActivityB">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
As far as I know, this should definitely not be happening, and works fine after you clear the history stack the first time.
Thanks
Related
I've just setup App Links within my Android app, following the official Android guides online. I can click on a link and my app launches just fine.
However, I observe different behaviour depending on where the link was clicked from.
From the Gmail app, my app launches and all works well. Clicking the ||| icon at the bottom of the screen shows my app is running standalone.
From Slack, my app launches and works fine, but it appears to be a part of the Slack process. The back button doesn't function, and if I click on the ||| icon at the bottom of the screen then it shows that my app appears to be running inside Slack (there's only one window open).
From WhatsApp, the same happens as Slack.
This is from my AndroidManifest.xml:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="mydomain.com"
android:path="/" />
</intent-filter>
I suspect this is somehow related to Slack opening web links itself, but I don't know how to prevent this. This also doesn't explain the WhatsApp behaviour, as WhatsApp already seems to open web links in Chrome independently.
Any advice would be appreciated!
That's actually the default in Android- your app is launched as part of the caller's stack. You need to set the launch mode to singleTask in the manifest. Please note that this may sometimes cause onNewIntent to be called rather than a standard activity creation path, if the activity is already alive in the background.
I have successfully set up an intent-filter in my Android app to open the app from the mobile browser based on one of many SO posts on this topic.
However, the problem is that the native app is opening WITHIN the browser, when I rather want it to open OUTSIDE of the browser in a separate app process.
By WITHIN, I mean that when I press the rightmost 'active apps' button to see what is running, I see that my current app is still the browser app, and there is no separate app opened called MyApp. It is as if the browser embeds my native app within itself, and so the browser is executing my app process.
And by OUTSIDE, I mean that I want to be able to see two active apps running after I press the link: (1) the browser app from which I launched (2) my MyApp app.
This is my intent-filter set up in AndroidManifest.xml:
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="myapp" android:host="mypath" />
</intent-filter>
And I link to this from a web page opened in the browser using:
Open app
How can I force the app to open OUTSIDE of the browser? One note is that when the app launches I don't see an 'app chooser' which I've seen for other apps.
By WITHIN, I mean that when I press the rightmost 'active apps' button to see what is running, I see that my current app is still the browser app, and there is no separate app opened called MyApp.
Your activity was launched within the browser's task.
It is as if the browser embeds my native app within itself and itself is executing my app process.
That is not what is happening.
How can I force the app to open OUTSIDE of the browser?
If you mean that you want the activity to appear in a separate task... ideally, that would happen by default. I'm surprised that a browser would not have added FLAG_ACTIVITY_NEW_TASK when it started your activity.
That being said, android:launchMode="singleTask" on your <activity> element should give you the desired behavior.
I'm developing an android application for my customer. And in that, the User needs to work with that application only. The User should not use any other applications in the Tablet, and my application need to be the default application after i installed the application...
If i shutdown the Tablet my application will be stoped, and if i switch on the tablet means my application will be automatically started.
could i achieve this, any steps to achieve for it..
Help me to fix this, Thanks in Advance
you can start your application while boot is completed using broadcaste but you cant stop the app getting exit while user pressed home button.
You may define your activity as Home, in the manifest file, define as below:
<activity android:name=".YouClassName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
This way, after install you application, when user long tap the Home button, Android would prompt use to choose which HOME to enter, one is the system default, the other is your activity. At this time, user may also set your activity as default HOME, then when power on, system enter your activity automatically.
If you permission to delete system default launcher (the default home), then your activity becomes to be the unique home.
I made an exceedingly simple app consisting of a launch activity (.TestActivity) with nothing more than a button on it, and a 2nd activity (.second) with nothing more than a piece of text on it.
Then I create an .apk file from it and sideload it to my phone, I open the app, click the button and go to the 2nd activity, press Home to make the app leave the screen, and then press the icon of the app to open it again, it resumes on my FIRST activity and not the 2nd one that I would expect.
After I force close the app it works properly, though! Where is the problem here? It's not my phone because I've seen this on several other devices that I've tested with. It's not necessarily Eclipse because it works as expected on Eclipse (and the emulator), it's possibly the manner in which I package the .apk file (but even then it's a pretty standard "export" that I'm doing from Eclipse so I'm not sure what that would be). Any other ideas?
Here's the manifest:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".TestActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="#string/app_name"
android:name=".second" >
</activity>
</application>
Why would force closing the app make it work how I want it to work the 2nd time, though?
Here's the deal. In your Android Manifest you identify which Activity you want to load when launching your app. If, for some reason, your app is not resident in the task stack Android will launch that Activity. If your app is in the task stack Android may choose to bring it to the front and you could be looking at whatever Activity was showing when you left the app. The thing is you cannot count on this. If you want the first Activity to show only te very first time the user launches your app you need to set a flag and then on subsequent launches you can automatically launch the second Activity based on that flag.
I just found the following links:
http://code.google.com/p/android/issues/detail?id=26658
and a decent workaround here: Home key press behaviour
I understand what CaseyB is getting at, but I can reproduce this every single time. If my app has a memory leak or ends up getting killed due to inactivity or the need for Android to reclaim some of its resources, that's one thing. But this seems pretty obviously like a bug to me and I'm just going to have to live with the workaround for now.
When I launch my android application from eclipse, it shows the home screen, and I then need to unlock the screen and go to my app. I would like it to just show my app by default.
I have tried right clicking on the app and selecting Run As..., but Android Application is not a choice there. I need to manually create a new Android run configuration for my application and then I launch that.
Is there a way to just make my app show by default? I'm running with the emulator for Android version 2.2?
Note: I'm also getting an error that says "Emulator] Unknown savevm section type 95" which I'm not sure what that means yet
thanks,
Jeff
The emulator always starts with the screen locked. Unlock it and wait a moment, sometimes it needs a minute to launch your app. If it doesn't work after a few moments, leave the emulator open and try running it again. If it doesn't launch now, there's something wrong.
I'm thinking you either didn't create your project as an android project to begin with, or if you did you didn't create a starting activity (or deleted the one that you did create)? Either way, you probably need to go edit your AndroidManifest.xml file and add an intent filter to an activity. Just guessing. Should look similar to this:
<activity
android:name={String for the name of your app}
android:label={String for the name displayed on the icon}>
<intent-filter>
<action
android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
** posted before your edit ^^^
In terms of your error, I have no clue what that is, so maybe it has nothing to do with your AndroidManifest, then. :T
Check your manifest, and make sure your activity has the correct intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
BTW, Previous to Android 1.6 i think the emulator always started with the screen locked then they changed that and it starts with your app