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
Related
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
When I run my developed android wear app via Android studio, it normally installs in my watch and can be later launched via wear launcher. Not sure what could happen, my latest project does not appear as icon in the launcher anymore, despite I can see the app being launched and fully functional, but after the ambient mode, when the app is moved to the background, I cannot relaunch from the wear. The only way would be to launch it from Android Studio again. The app icon was deleted from watch and I cannot figure out why!
When I check the list of packages in the phone via ADB, I can see it listed, but it never appears among installed apps in the wear, and it did few days ago.
I have LG G Watch R with Android 5.1.1, Android Wear 1.3.0.2166028, and Android Studio 1.5.0/141.2422023
This is what I figured out by trying different manifest setups:
When providing the intent filter to start your main activity in the wear manifest as a combination of action.Main and action.TRACK category with mime type /running, the activity will not register in the launcher with an icon, only voice action OK GOOGLE START RUNNING will launch the activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="vnd.google.fitness.TRACK"/>
<data android:mimeType="vnd.google.fitness.activity/running"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
To get the icon back to the launcher I had to make a compromise of loosing the ability to start the main activity with the voice launcher.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /></intent-filter>
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 have 3 android applications. One main application call other 2 applications (main application will be interface for other 2 applications). I would like to have only one icon of this main app. I have 3 applications they can be downloaded separately. Now I need the other applications to check if the main application is installed. If not, download and install main app. But how can I do that, if the secondary applications haven't got LAUNCHER ? Is there any way to do install main app from app without launcher ?
Main app has android manifest:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Secondary app has manifest (because do not want icon)
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
Yes I know how to use code in app where is launcher to check app is installed, but dont want how to operate with, when the launcher is not.
if (installed==false) {
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setData(Uri.parse("https://play.google.com......))
.setType("application/vnd.android.package-archive");
startActivity(promptInstall);
Or second question: is it possible to install app with launcher and then uninstall/hide icon of this app ? Let's say simple I will install all aplications with launcher and then after installation and settings hide icon of app, so that stay only icon of main application.
It looks strange for me, there is not any simple way to do that, simple set if icon will be visible or not. The same as you install software on Windows and you can set during installation if icon will be visible on desktop.
I'm not sure if this is expected, if it's a bug and whether or not there's a workaround.
When a user hits the home button in our Android Phonegap app, the application minimizes properly.
When the user clicks the icon to launch the app, it restarts from the beginning. This is undesirable.
After a user minimizes the app by clicking the home button, there are two ways the app will resume properly:
A long press on the home button and clicking the app will resume the app in its last state.
Clicking a notification in the status bar (push notification) will resume the app in its last state.
So my question is, what do we need to do to resume the app in the same way those above two items do when the user clicks on the app icon from the desktop? The app is running and healthy as item 1 listed above confirms.
Any help would be greatly appreciated. Thanks!
I had the same problem . My app was getting restarted when i click the app icon to relaunch the already running app in the background.
Basically if the android:launchMode is set to standard or not set ,then a new intent is created for the app and the old paused state of app is not resumed .
So the best way around i found was to apply
android:launchMode="singleTask"
in the AndroidManifest.xml -> inside <activity> .
please conside this example :
<activity android:name="Example" android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>