Whenever I run my app from Android studio, an Activity having
android:exported="true"
get's launched instead of launcher activity
<activity
android:name=".activity.SplashScreen"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
But once app installed, correct launcher activity opens, no issue.
Only issue happens when I launch my app from Android studio(i.e. by running the app). So why this happens?
Without android:exported="true", on some devices, that activity not gets launched after clicking notification of my app. So is it good to keep exported true?
Also I can't post my entire manifest here
When running the app from Android Studio, you're probably using instant run. which applies the code changes to the current running process of your app, so instead of installing the app again, it applies the new changes to the running app, in that case you see the current running activity as it is.
http://android-developers.blogspot.com.eg/2016/04/android-studio-2-0.html
https://developer.android.com/studio/run/index.html
If it only happens in Android Studio and not when the app is installed, it is most likely a problem with the run configuration. You can access it by going to
Run -> Edit Configurations
Related
I tried to upload a testing app (just blank page) to my phone.
I can see my phone in the list when I press run and there is no new app in my phone and nothing apears there.
why?
thank you.
Firstly, if you app is failing to compile, you will need to check Android Studio for compilation errors. These can be found in the Messages view.
To put your app on a device, your test device will need USB Debugging enabled on it. Please see this answer for more information on how to turn it on should you have missed this step.
If the app is compiling but isn't starting, ensure that you have the following intent-filter within your main activity's definition in your AndroidManifest.xml file.
<activity
android:name=".YourMainActivityName"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This intent filter is how the Android OS works out which activity to launch when the app is freshly opened. Without this filter, no activity will start.
I created react native App for android after installing it on a real device
That is the scenario that generate the issue,
If I navigate to any screen inside the react app (other than the home screen)
then I opened another app
and back again to the react app, it back to the home screen not to the screen that I was open before.
That doesn't happen with the emulator, and I can't know if that happen because the react app closed when opening another app or it just reload the app when I back to it.
Any suggestions??
Add launchMode attribute to your activity in AndroidManifest and try.
<activity android:name=".MainActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
I'm facing the following issue. I have an app with an established user base, and I wanted to change my default launcher activity for the app.
The problem happens only for some users that updated the app via Google Play. Problem does not occur when running via Android Studio.
The problem comes into play with some of the users' Launchers on their phones. After they update the app, and when they try to open the app from their homescreens some users get "Error app not installed" or "Activity does not exist" errors.
It seems that on some users' devices, the OS launcher adds additional information about the activity name and this causes an issue after they update the app.
What's the correct way to change the launcher activity in order to avoid the problem I described above? This is quite an issue as a lot of non-techy users just uninstall the app.
Previously .TabHostActivity was set as Launcher/Main
After making .SplashActivity as Launcher/Main and rolling out the update to Google Play, some users started receiving "App not installed" error when opening the shortcut from their homescreen. App still works if they open it via App Drawer, but the shortcut on the homescreen gives this error.
Code:
<activity android:name=".SplashActivity" android:screenOrientation="portrait" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TabHostActivity" android:configChanges="keyboardHidden|orientation|screenSize">
</activity>
Make TabHostActivity Launcher activity again.
In TabHostActivity at first check if it has been opened from SplashActivity (You can add a flag in the intent while starting the TabHostActivity from SplashActivity and check the same flag in TabHostActivity)
If TabHostActivity has not been opened from SplashActivity, then redirect to SplashActivity.
All of the above should be coded before any other code in OnCreate of TabHostActivity.
I'm using Mosync SDK 3.2.1 to develop a HTML 5 application for Android 2.2, 2.3 and 4.03. I had the issue described in this post http://jira.mosync.com/browse/MOSYNC-2367 . The fix proposed
android:launchMode="singleTask"
solved the "restarting of the app" issue when launching the app from menu but broke the launching behavior of the app via notifications when the app is working in background. (in launchMode="standard", works fine, the app resumes). With this fix it crashes with the message "Unfortunately, Zymbo has stopped" (4.0.3) and "The application Zybmbo has stopped unexpectedly."
If the application is not working in background the launch via notification works fine, the app is started.
This is how the MAIN activity is declared in manifest file.
<activity android:name=".MoSync"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This is how the application behaves right now:
1. Launch the application via menu shortcut
2. Press "Home"
3. Launch the application via menu shortcut (launchMode="standard" => restarts the app BAD / launchMode="singleTask" resumes the background app OK)
4. Press "Home"
5. Launch the application via notification item (launchMode="standard" - opens the app working in background OK / launchMode="singleTask" the app crashes BAD)
What I want to achieve is if the application is running in background and I click the notification or the app icon from menu, i want the application to resume and not to start again.
Any hint is appreciated, Thank you,
Mike
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