1

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" />
Tom
  • 1,229
  • 1
  • 9
  • 10
  • Try taking everything out of your .MainActivity intent expcept the .MAIN and .LAUNCHER ... so it would look like – jesses.co.tt Sep 18 '16 at 20:22
  • @jesses.co.tt removing the data element from the intent filter worked (see the edit). Do you have any idea how to include such filter and still have a functioning app? – Tom Sep 18 '16 at 20:26
  • Yeah, its been a while since I used them, but I think they just shouldn't be in your launcher activity. Essentially you want to deep link to a specific activity anyways, right ? – jesses.co.tt Sep 18 '16 at 20:29
  • See the first answer to this question: https://stackoverflow.com/questions/29477542/app-not-listed-in-launcher-due-to-data-androidscheme-http-in-androidmanif – jesses.co.tt Sep 18 '16 at 20:31
  • @jesses.co.tt whenever I open the main activity I want to run my OAuth authentication, and go back to the main activity (which is what the data element of the filter does). I guess I could use a separate activity for oauth, and then go back to the main activity :) Thanks for your help. – Tom Sep 18 '16 at 20:33
  • Right, that is a valid use case... see the answer I posted (copied from the linked Question above) – jesses.co.tt Sep 18 '16 at 20:34
  • 1
    @jesses.co.tt Or I could do the solution in that link you sent me. Thanks very much – Tom Sep 18 '16 at 20:34
  • @jesses.co.tt worked like a charm. Thanks very much – Tom Sep 18 '16 at 20:36
  • NP. I jsut dd some research, as it was an interesting question. Credit to @helbaroudy for the original answer – jesses.co.tt Sep 18 '16 at 20:37

1 Answers1

6

Copied from here: https://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>
Community
  • 1
  • 1
jesses.co.tt
  • 2,689
  • 1
  • 30
  • 49
  • This solution worked for me. Thanks for all of the help. In my case (as my intent used the browser), I needed the following line in the second intent filter: – Tom Sep 18 '16 at 20:37
  • No problem. Remember to upvote or mark as accepted answers that you find useful (when you have enough reputation). Also make sure to upvote the original answer! – jesses.co.tt Sep 18 '16 at 20:38
  • Marked as answered :) Sadly the upvote doesn't count because of my low reputation. – Tom Sep 18 '16 at 20:42
  • Yeah, it'll happen ;) – jesses.co.tt Sep 18 '16 at 20:44