Running Google Glass sample app on Android Virtual Device(emulator) - android

I am trying to run the Timer sample google glass app, but when I run the project, it gets installed and then says DONE, however, I don't see anything on the emulator. I know there is no Launcher and so I tried the RUN CONFIGURATION but I don't see any activity in the dropdown when I chose the Launch option. Any thoughts or guides on to do this ?

First of all there is no avd/emulator available for Glass.But if still you are interested converting your mobile phone into glass.Check these link i.e 1,2,3.But no one works completely treating your phone as Glass.
As you have mentioned above that you try to install an app on emulator.The main reason why it is not showing up is that:
Move to AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
This is the normal code for the main launcher activity of android.This is the main activity which is launched in the emulator/avd
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
While in Glass code you find something like this.There is no launcher in Glass but still you can add.Here you only found out the voice trigger which open your app
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voicetrigger" />
</activity>

Related

How to stop Android activity opening from USB device being attached if activity is already open?

I am using the Android USB host and an intent to open an app when a device is connected to the phone. However, if the app is open, I do not want it to open again.
Below is the relevant code from the manifest file:
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/device_filter" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
I have Java code that can detect the device if the app is already open, so no need for the app to open again. In practice, this is just an annoyance. The app is open, and another "copy" opens on top of it.
Sounds like you need to set a flag in the activity's manifest entry.
Either singleTask or singleInstance, depending on your needs. See the documentation for what each means:
Hope that helps!

Cant upload my app with Android Studio

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.

Create shortcut in home screen on publishing android app in mobile

I am developing one android app its almost developed and I am able to successfully publish it in my mobile and its working fine, but its not creating a shortcut in home screen after install, can somebody please help me how to create shortcut after install.
This is the best answer I found (https://stackoverflow.com/a/23893035/2507782) because in this we are checking if shortcut already exist and along with this some modifications in manifest files are.
<activity android:name=".ShortCutActivity" android:label="#string/shortcut_label">
<intent-filter>
<action android:naenter code hereme="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
and
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

The application I'm developing does not appear or open in my android device

I am currently building an application in Android Studio. When I run my application and Android Studio installs it on my device through the USB, the application doesn't open and doesn't show up in the Apps list of my device. Which is strange because when I travel to Settings > Application Manager in the device, it shows my application as if installed but I can't open it. I also have tested the application in the Nexus emulator and it opens up just fine.
you're missing a intent-filter in your "main" activity so that it can show in the launcher. below is an example:
<activity
android:name="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
replace "MainActivity" with the name of the activity you want to show in the launcher.

Can't find my installed application

Greets,
Made some app on android. I for the life of me can't get it to install on the phone as a stand alone application. It runs fine when I deploy from eclipse but never remains on the device. any idea whats happening?
I put the apk file on a web server, went to the address downloaded and installed but still it wasn't to be found.
I'm lost!
Make sure your application manifest defines an activtity with a category of LAUNCHER. For example:
<activity android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Otherwise, the Android apps screen won't pick it up.

Categories

Resources