I'm an Android developer and I'm trying to develop a custom Android Auto app, that does a simple mirroring of the phone screen.
I know that currently the API are only available for music and messaging apps, but I would write an app for mirror a simple "hello world".
I follow the Google Getting Started tutorial and I'm using the Desktop Head Unit (DHU) provided by Google (at developer.android.com/training/auto/testing/index.html)
but when I tap last button on the bottom of the display and select "All car apps", my application doesn't appear on the list.
All car apps
For example, if Android Auto is launched in a Samsung tablet (SM-T555), the DHU lists these app:
com.google.android.gms, Maps, System UI, Video, SampleAuthenticatorService, SecureSampleAuthService, Screen capture, Android Auto, Phone, Media, Return to Google, Samsung Billing, Google App, Google Play Music, Music
Available Car Apps in a Samsung Tablet
How can I make an app that is displayed on the available app list in Android Auto? Is possible do mirroring for a custom app in Android Auto?
Create a service like this:
public class HelloWorldService extends CarActivityService {
#Override
public Class<? extends CarActivity> getCarActivity() {
return HelloWorldAutoActivity.class;
}
}
Then add the service to your manifest like this:
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="#xml/automotive_app_desc" />
<service
android:name=".HelloWorldService"
android:exported="true"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.google.android.gms.car.category.CATEGORY_PROJECTION" />
<category android:name="com.google.android.gms.car.category.CATEGORY_PROJECTION_OEM" />
</intent-filter>
</service>
Finally create a xml file called automotive_app_desc under your res folder:
<automotiveApp>
<uses name="service" />
<uses name="projection" />
<uses name="notification" />
</automotiveApp>
Your HelloWorldAutoActivity.class will work as your MainActivity.
Android auto not customized. some api (audio, map, contacts) are same, customized.but you can dolittle things. pls check this
https://github.com/Mutesham/AndroidAuto_TextApp
In order to have app displayed on the Auto. You will have to upload it to playstore on beta channel.
The Main Activity File
The main activity code is a Java file MainActivity.java. This is the actual application file which ultimately gets converted to a Dalvik executable and runs your application. Following is the default code generated by the application wizard for Hello World! application −
package com.example.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
The Manifest File
Whatever component you develop as a part of your application, you must declare all its components in a manifest.xml which resides at the root of the application project directory. This file works as an interface between Android OS and your application, so if you do not declare your component in this file, then it will not be considered by the OS. For example, a default manifest file will look like as following file −
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tutorialspoint7.myapplication">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The Strings File
The strings.xml file is located in the res/values folder and it contains all the text that your application uses. For example, the names of buttons, labels, default text, and similar types of strings go into this file. This file is responsible for their textual content. For example, a default strings file will look like as following file −
<resources>
<string name="app_name">HelloWorld</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
</resources>
The Layout File
The activity_main.xml is a layout file available in res/layout directory, that is referenced by your application when building its interface. You will modify this file very frequently to change the layout of your application. For your "Hello World!" application, this file will have following content related to default layout −
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="#dimen/padding_medium"
android:text="#string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
Related
I have an unclaimed bounty for this question. If someone is able to provide a working answer that meets my criteria, I will reward them with the bounty. It’s not visible because the bounty expired, but I can reward it after the fact to an acceptable answer.
My app has intent filters set up that work as desired when I use Chrome. Unfortunately, Firefox does not implement deep links the same way. When I tap a link in Firefox, it shows a little Android icon at the end of the address bar. If I tap that, it will open my app in Firefox and I don't like this behavior. With Chrome, it simply opens the app (after prompting you to choose the app the first time)
UPDATE: singletask does not work and it has the heinous side effect of the resuming activity not being able to get the extras from the intent that launched it.
This is not a duplicate of other deep link Firefox questions (this, this, this, this, this, this, and this) because those questions are about how to get deep links to work at all whereas I understand how deep links work in Firefox and they already work for me, but I want to change the behavior...
I'm asking: How, if possible, can I open the existing instance of my app via deep link from Firefox and have it behave the same way that it does with Chrome? I don't want use an iframe.
I have implemented http and https intent filters, like so:
<!-- https -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="myappurl"
android:pathPrefix="/myprefix"
android:scheme="https" />
</intent-filter>
<!-- http -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="myappurl"
android:pathPrefix="/myprefix"
android:scheme="http" />
</intent-filter>
If you're going to provide a solution, please provide a clear example that includes context as to where the code should go in the manifest (if at all), and what the side effects are (see my link above- singletask does not work for this)
You have to put android:launchMode="singleTask" under your activity tag.
This prevents opening multiple instances. If your app is already open it will launch it, else it will create a new instance.
I know that for whatever reason google decided to make all button text capitalised in lollipop.
How do I set it in my appcelerator app that all my button text is not uppercase, but just however I typed it?
All you need is to define a android values under
/app/platform/android/res/values.xml
<resources>
<style name="Theme.myTheme" parent="#style/Theme.AppCompat.NoActionBar">
<item name="android:buttonStyle">#style/customButton</item>
</style>
<style name="customButton" parent="Widget.AppCompat.Button">
<item name="android:textAllCaps">false</item>
</style>
Add android theme to manifest (Theme.myTheme):
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<supports-screens android:anyDensity="false"
android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
<application android:debuggable="true"
android:icon="#drawable/appicon"
android:largeHeap="true" android:theme="#style/Theme.myTheme">
<activity
android:configChanges="keyboardHidden|orientation|screenSize" android:name="org.appcelerator.titanium.TiActivity"/>
</application>
</manifest>
</android>
Why do you need to use a button and depend on the system's default layout?
You could just use a View instead and listen to the click event.
You could style the view as you wish and it would look the same across different platforms.
How to show the application name in the tiles.
As shown in the figure, i am developing the last application in the screen. For that i need to show the name of the application.
In PackageManifest file i have added all the images to show the images in the home screen.
Any help on this highly appreciated.
Thank you.
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="MMRevamp_2016.App">
<uap:VisualElements DisplayName="Maalaimalar" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="MMRevamp_2016" BackgroundColor="transparent">
<uap:LockScreen Notification="badge" BadgeLogo="Images\BadgeLogo.png" />
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square71x71Logo="Images\Square142x142Logo.png" Square310x310Logo="Images\Square310x310Logo.png">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
</Applications>
If you open your Package.appxmanifest and go to Visual Assets, you will see show name with check boxes. Check off appropriate box next to your asset.
See Screenshot for Example
If you are doing XML you can set the branding attribute to "name" as well. E.g like this:
<tile>
<visual>
<binding template="TileMedium" branding="name">
</binding>
</visual>
</tile>
I'm new to Xamarin. How can i design a pop up menu that looks like google play menu in Xamarin ? I.e see the image below :
There are several ways to go about making a fly-out menu, which is what I believe you are after. The very basic approach, is to add something similar to the following to your AXML:
<?xml version="1.0" encoding="utf-8"?>
<flyoutmenu.FlyOutContainer xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
layout="#layout/MenuLayout" />
<include
layout="#layout/ContentLayout" />
</flyoutmenu.FlyOutContainer>
Source: http://blog.neteril.org/blog/2013/04/19/fly-out-menu-xamarin-android/
Another Source: http://www.appliedcodelog.com/2016/01/navigation-drawer-using-material-design.html
I hope this helps!
I have finished my app after 8 months work and I am attempting to submit to Google Play.
I sign the and align the APK properly and upload the APK to Google Play. Then I get the following message:
Upload failed Your APK's package name must be in the following format "com.example.myapp". It may contain letters (a-z), numbers, and underscores (_). It must start with a lowercase character.
Here is the AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.vrocket.launcher" android:versionName="1.30.637" android:versionCode="1">
<uses-sdk android:targetSdkVersion="14" />
<application android:hardwareAccelerated="true" android:label="launchpad">
<provider android:name="com.vrocket.launcher.LocalFileContentProvider" android:authorities="com.vrocket.launcher" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
As far as I can tell, the package name I specify here meets the requirements for Google Play submission. I did change my package name in the Android.Manifest since I started the project but I figure this would be pretty normal practice.
Has anyone had similar issues submitting a Xamarin.Android app to Google Play?
EDIT:
I have since figured out that the APK is being compiled with an old package name VRocket.VRocket.
I found this out using the aapt tool in the Android SDK.
Why is it not building with the package name specified in AndroidManifest.xml?
The properties window in Visual Studio (assuming your writing in this) has a couple of settings you can change. These override the manifest when you compile. Perhaps this is where your stray name is coming in from? Same goes for the attributes you place in the class files in your code, Xamarin rewrites all of your manifest on compile. If you display hidden files in the solution tab and go to
obj\Release\android
this directory has the manifest that is generated for your app. Maybe it will shed some light.
I'm using DevStudio and did all of the following things, the last of which FINALLY worked and the Play store accepted my build. I'm pretty sure #2 and #5 are required, maybe all of them, but in any case I think this should go a long way to helping people in a similar situation:
Changed the filename to com.foo.bar.apk (pretty sure this doesn't
matter)
Right-clicked on ProjectName.Droid, Properties-->Android Manifest. Changed the Package Name to com.foo.bar
In that same dialog, set Version Number to 1 and Version Name to "Alpha 1"
Under Properties-->Application, changed Assembly to com.foo.bar
In the Archive Manager, right click on my app and Delete it. Re-create via right-clicking on project again and choosing
Archive...