Tom Tom - 2 months ago 14
Android Question

Android: Can install apk but can't open (open greyed out)

I'm well down the road of creating my first android application. I can run it on my phone (Android 6.1) fine from android studio via the ADB, however am completely unable to access it when not connected to the computer.

If I install the apk manually, the app installs fine but the "Open" button is greyed out at the end of the installation. The app also doesn't appear in my app draw, however does appear in my installed applications under settings.

Has anyone got any suggestions?

Here is my android manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.mediasyncer">

<uses-permission android:name="android.permission.INTERNET" />

<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"
android:label="@string/app_name"
android:enabled="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>
<activity
android:name=".ShowActivity"
android:label="@string/title_activity_show"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".SeasonActivity"
android:label="@string/title_activity_season"
android:theme="@style/AppTheme.NoActionBar" />
</application>

</manifest>




Edit: I am able to install apks from unknown sources.

It seems that removing the following allows me to open the app. Any suggestions how I can include that in my intent and still open my app?

<data android:host="oauthresponse" android:scheme="mediasyncer" />

Answer

Copied from here: http://stackoverflow.com/a/29477867/1226095 with slight adaptations

Due to the intent-filter matching/resolution process, when Android "shows the applications" in the launcher, it shows the list using matching mechanism, and when you add you app doesn't match, because the system doesn't bring any data when it displays the launcher.

The solution is create another intent-filter, for example:

 <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:enabled="true"
        android:theme="@style/AppTheme.NoActionBar">
          <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data
                        android:host="oauthresponse"
                        android:scheme="mediasyncer" />
                </intent-filter>
       </activity>