I have started developing on Google glass but i found something very weird. Activity ends when Google glass goes to sleep? Can anyone help me on how can i stop the glass from killing the activity.
I was having a very similar issue. I also found a related question here: https://stackoverflow.com/questions/31318952
As noted in the comments by the poster, adding the immersive property to my AndroidManifest.xml fixed the issue and the Glass now always wakes up to my Activity.
<activity
android:name="com.my.app.ActivityName"
android:immersive="true">
</activity>
Related
i got this problem in some device, mostly china rom, problem is when plugged-in/out, the onDestroy called, then onCreate called -> activity restart, i tried to find anything of code that relate to this problem but not working.
Can anyone help me know the problem? Thanks
more update:
Here is the sample of one screen
<activity
android:name=".Screen.ChatScreen"
android:configChanges="orientation|screenSize"
android:theme="#style/AppTheme.AppBarOverlay"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
i tested then all screen restarted, not only one, only some specific android device. Samsung work normal
My app needs to display activity over the lock screen, And that is not working particularly on xiaomi devices, After some research I found that there is need to enable Show On Lock Screen permission.
I found that some of the applications on play store has this permission enabled by default,I have done lots of research but not found anyway of doing the same, Please help me with this
the following code worked for me, give it a try
<activity
android:name=".activities.alarm"
android:launchMode="singleTask"
android:showOnLockScreen="true"
></activity>
I'm running Android 7.1 and I cannot for the life of me figure out how to ensure "car mode" doesn't start when the device (honeywell CT60) is docked. I've already tried the following:
installing app "no dock"
installing app "car mode off"
getting app devs to add uiMode to the <ACITIVTY> element in the manifest.xml file.
None of these seem to work.
Does anyone have any advice or ideas?
Perhaps even an app that force the device to not go into car mode.
You're on the right track. According to Honeywell the app's AndroidManifest.xml has to be modified in the following way:
<manifest>
<application>
<activity android:configChanges="uiMode">
[...]
</activity>
</application>
</manifest>
This has to be added for each activity, where CAR_MODE should be disabled. It signals to the OS that the app will handle changes regarding the UiMode itself. Now instead of restarting the app to apply changes, the OS will leave handling this change up to the app.
If you want to find out how exactly it works, there already is a post explaining it. Alternatively you can find a guide about this topic at the Android Developer Docs.
Everytime after couple minutes of idle state, screensaver appears on my phone. It makes my Android application restart. Do you know how to overcome this? Of course, I know I could turn off the screensaver, but it's not the solution I am looking for.
What do you mean by restarts? What do you mean by screensaver? If I understood your question correctly you must check if you have this line in your AndroidManifest.xml:
android:configChanges="keyboardHidden|orientation"
This will prevent your activity from being restarted on runtime 'configuration changes'.
I have an app where all activities have the orientation overritten to be portrait.
This is what a random activity declaration looks like on the Manifest:
<activity
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:name=".activities.LeaderboardActivity"
android:screenOrientation="portrait" >
</activity>
There's nothing else changed for that matter on the LeaderboardActivity.java.
That code runs just fine on my phone, but when I loaded up the emulator to get some screen shots, it keeps sending me the following error:
"The application Android keyboard (process com.android.inputmethod.latin) has stopped unexpectedly. Please try again"
When I click "Force close", nothing happens, the app keeps running but the error pops up again in less than 10sec, making it impossible to do anything.
Has someone else experienced that kind of problem before?
And it's not a specific problem with my emulator, because all members of my team are getting the same error on their pcs, but not on their phones.
EDIT:
My friend told me he encountered this same problem, and resolved it by opening the AVD manually before starting the app, and only call the app when it's fully loaded. I still haven't tried that, I'll update this when I test this method.
Why are you using android:configChanges="orientation|keyboardHidden" since you are forcing android to stay on portrait orientation? Maybe that's the problem.. did you tried to get it off?