Android: after installing an APK, the open button is disabled - android

I read in so many places that the problem is related to the manifest and the definition of the first activity. It seems that I'm doing fine but still the open button, after installing the APK, is disabled and I don't see the icon on the device
<application
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<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.BROWSABLE" />
<data android:scheme="http"
android:host="www.example.com"/>
</intent-filter>
</activity>
<activity android:name=".DateSelectorActivity"
android:label="#string/app_name">
</activity>
</application>

Your problem is this:
<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.BROWSABLE" />
<data android:scheme="http"
android:host="www.example.com"/>
</intent-filter>
Here, you are saying that this activity will only be launched if:
the Intent has an action of MAIN or VIEW, and
the Intent has the categories of LAUNCHER or BROWSABLE, and
the Intent has a Uri with a scheme of http and a host of www.example.com
The home screen launcher and Settings app will not be creating such an Intent, and so they cannot launch this activity.
Either:
Remove the VIEW, BROWSABLE, and <data> portions of what you have, or
Move those into a separate <intent-filter>:
<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.BROWSABLE" />
<data android:scheme="http"
android:host="www.example.com"/>
</intent-filter>
Multiple <intent-filter> elements represent an OR operation: an Intent that matches the first filter or the second filter will work for this activity.

I ran into the same problem, but maybe caused by different reason.
Running following command line worked:
adb uninstall com.company.mayapp

Related

How to show my app in "Open with" list on android

I create a simple app with webview that can handle/open any URL. But the problem is that my app will not be shown in open with list when I click on any hyperlinks.
As shown in above image I click on a hyperlink and it popup an open with list but my app is not shown here. So, I want to show my app also shown in this open with list.
Manifest code:
<application
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name="biz.coolpage.aashish.app.MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:theme="#style/AppTheme.Translucent.Light"
android:hardwareAccelerated="true"
android:launchMode="singleInstance"
android:alwaysRetainTaskState="true">
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="text/link"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Add another activity with this intent filter
<activity
android:label="MyBrowser" android:name="BrowserActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="http"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>

App not showing in launcher

After installing an app via the run command on Android Studio, the app launches correctly, I can see it in the applications list and account manager.
The problem is that it doesn't show up at all in the app launcher. (I have Google Launcher installed on the Nexus 5 device which I am testing on and everything was working fine before 6.0.1).
App name is "Pumpkin".
Here is the manifest
And here's the screenshot where Pumpkin's supposed to fit.
Your Intent-Filter seems to be wrong. Change to:
<activity
android:name="com.pumpkin.activities.SplashScreenActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="pumpkin.com" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Add this intent filter to your splash screen activity:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
your deep link
https://sureassure.com
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".Main2Activity">
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="sureassure.com" // website name
/>
</intent-filter>
</activity>
</application>

Intent for opening url creates new instance

I added an intent filter in the Android Manifest to handle intents for opening a URL:
<activity android:name=".TestActivity"
android:label="Test" android:theme="#style/Theme.Titanium"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:launchMode="singleTop" >
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="test.com" />
</intent-filter>
</activity>
The issue I have is when the App is already open, this code launches a new instance of the App which can be very confusing to the user. After the launching the new instance, if the user navigates away using the Home Button and then returns to the App, they see the 1st instance. How can I Fix this?
android:launchMode="singleInstance" >

Where do I add my intent-filter in AndroidManifest.xml?

Here is what I am trying to set up: My Android app requires email confirmation. They register using my app, and then an email is sent to them with a link. I want to have that link open the app directly, but I've been told it's better to have the link open page on my web site that in turn opens the app using a redirect. The link also sends the user's email address and a verification code.
Okay, so, do that, my understanding is that I need to add this code to my AndroidManifest.xml (where MYAPP is the name of my web site):
<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:scheme="http" android:host="MYAPP.com" android:path="/confirmation.html" />
</intent-filter>
And then my web site has a page with this in the <head> (where MYAPP is the name of my app):
meta http-equiv="refresh" content="0;URL=MYAPP://?verification=' . $_GET["verification"] . '&email=' . $_GET["email"] . '"/>
It's not working, and I'm possibly making multiple mistakes.
First question is, where does my <intent-filter> go? I've only read that it goes within the <activity> tags, but in my AndroidManifest.xml, I have two <activity> tags:
<activity android:label="#string/app_name" android:name=".MYAPP" android:screenOrientation="unspecified" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.phonegap.DroidGap">
<intent-filter />
</activity>
I tried adding my <intent-filter> in one, but that doesn't seem to work:
<activity android:label="#string/app_name" android:name=".MYAPP" android:screenOrientation="unspecified" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize">
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="MYAPP.com" android:path="/confirmation.html" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.phonegap.DroidGap">
<intent-filter />
</activity>
Where do I put my <intent-filter>?
Is the rest of my code, especially my redirect URL, okay?
Please note I am a beginner and I am using Phonegap to build this app, so please do not assume I know a great deal about Android app development. Thanks for your understanding.
Inside you activity tags like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".My_Activity_Name"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application
In this code of yours, where is the starting intent-filter tag for the last activity:
<activity android:label="#string/app_name" android:name=".MYAPP" android:screenOrientation="unspecified" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize">
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="MYAPP.com" android:path="/confirmation.html" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.phonegap.DroidGap">
<intent-filter />
</activity>
Turns out that I had my intent filter in the right place.
The reason it wasn't working was simply because I needed an extra line to account for https links.
So my code now looks like this:
<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:scheme="http" android:host="MYAPP.com" android:path="/confirmation.html" />
<data android:scheme="https" android:host="MYAPP.com" android:path="/confirmation.html" />
</intent-filter>

Open application from shared social platform

If someone shares http://myappAdurl.com from facebook than if another one clicks link, if application exist on that device, my app should be open,
I added following line to my manifest but I could not get the result, not working.
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".TinyUrlTest"
android:label="#string/title_activity_tiny_url_test"
android:launchMode="singleTask" >
<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" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.myappAdurl.com"
android:path="/images"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="www.myappAdurl.com" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
</application>
I also tried below project but it opens link such as com.commonsware.android.MY_ACTION
https://github.com/commonsguy/cw-advandroid/tree/master/Introspection/URLHandler
ok found that,
if i give
android:pathPattern="/*.*"
inside data element, then it opens everything

Categories

Resources