I have been trying to launch my Android app from a web browser link using the following code.
Please help me to fix/adjust the manifest file and and href code to call my application
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.rose.MoveMobile">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".app.MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
tools:replace="android:icon">
<activity
android:name=".Start"
android:configChanges="orientation"
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=".app.MyApplication" android:host="com.example.rose.MoveMobile"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
</application>
</manifest>
HTML code
Launch Apps
Thanks
Your URL has a scheme of http. Your <intent-filter> has a scheme of .app.MyApplication. These are not the same. Change your <intent-filter> to use http, or change both to something else that the browser will accept (I suspect that .app.MyApplication is not a valid scheme).
Also, please note that browsers are not required to launch apps from links. They may, but they may not. It is up to the browser developer.
<data android:scheme="http"
android:host="example.com"
android:pathPrefix="/myPath" />
This would match everything starting with http://example.com/myPath
So wither you need to change your scheme to http, or you need to change the link in your tag to use a custom scheme like myapp://somehost/somepath
<activity
android:name=".Start"
android:configChanges="orientation"
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="app" android:host="com.example.rose.MoveMobile"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
Html code:
app://com.example.rose.MoveMobile
Related
My manifest file is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ir.technovaa.offer">
<application
android:name=".OfferApplication"
android:allowBackup="false"
android:icon="#drawable/offer_icon"
android:label="#string/app_name"
android:supportsRtl="false"
android:theme="#style/AppTheme">
<activity
android:name=".activity.MainActivity"
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>
</activity>
<activity android:name=".activity.IntroductionActivity" />
<activity
android:name=".activity.CallbackActivity">
<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="offer.ir"
android:path="/refer"/>
</intent-filter>
</activity>
</application>
</manifest>
So, problem is in CallbackActivity, with the http scheme, CallbackActivity does not come up with a link, but if I change it to a custom scheme like android:scheme="offer" it works just fine and the activity will come up with the redirect link. So, what should I do for make http scheme works. Thank you.
I developed an application with Android studio and there is a very strange behavior:
After the installation I cant see the application (not the icon nor the name) in all apps list, but I can see that in recent apps and in manage apps.
I sent the APK to myself in email and after the installation the open option was disabled.
I checked the ic_launcher icons and they are fine.
What can cause that? Any ideas?
EDIT:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.package.name"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".SplashActivity"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait">
<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:scheme="http" android:host="my.package.name.host" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:configChanges="orientation"/>
<activity android:name=".LoginActivity"
android:windowSoftInputMode="adjustPan"
android:configChanges="orientation"/>
</application>
</manifest>
For me having the following lines in the intent-filter were enough to make the ICON appear in the launcher with the other apps
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
When you open the apk, that was sent by email or transfer to your phone you will see the INSTALL option and after succesfully installed the OPEN option is there.
Put tags at two intent-filters like here
<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>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http" android:host="qr_3d.com"/>
<data android:scheme="https" android:host="qr_3d.com"/>
<data android:scheme="app" android:host="qr_3d.com"/>
</intent-filter>
</activity>
Make sure the filter is as
should be MAIN and not activity_main, etc.
also remove min / max SDK setting line...
This worked for me
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>
I'm trying to register my Android app as a handler for iCal URLs. To do this I set intent filters in my Manifest for the webcal:// pseudo protocol and for HTTP URLs using the text/calendar MIME type (see below).
This works perfectly fine in the emulator, but on a real device I'm having problems. The webcal:// filter works, but the text/calendar one doesn't. Instead the Browser displays the ical file as plain text instead of passing the URL to my app.
I checked that the browser isn't configured as a default handler for ical (in Settings->Applications->Browser) and I asked a few other people if they could reproduce the problem on their mobiles. All with the same result.
What's the correct way to register for text/calendar URLs?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.splitbrain.giraffe"
android:versionName="0.31" android:versionCode="4">
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:icon="#drawable/icon" android:label="#string/app_name" android:theme="#android:style/Theme.Light.NoTitleBar">
<activity android:label="#string/app_name" android:name="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"></category>
<action android:name="android.intent.action.VIEW"></action>
<data android:mimeType="text/calendar" android:scheme="http"></data>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"></category>
<action android:name="android.intent.action.VIEW"></action>
<data android:scheme="webcal"></data>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
<activity android:name="OptionsActivity"></activity>
<activity android:name="DetailActivity"></activity>
<activity android:name="AboutActivity"></activity>
</application>
</manifest>
Update: Turns out the above works fine in the Android 1.6 emulator, but not on a 2.3.3 emulator where it shows the same behavior as on my phone. Is this a bug in Android maybe?
I opened a bug report at https://code.google.com/p/android/issues/detail?id=18796
Just use the DEFAULT category, the BROWSABLE category is might be causing the problem.
Add a .*.ics path pattern to capture any files that have been given the wrong mime type by the server
Put all the data matching into the same filter
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.splitbrain.giraffe"
android:versionName="0.31" android:versionCode="4">
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:icon="#drawable/icon" android:label="#string/app_name" android:theme="#android:style/Theme.Light.NoTitleBar">
<activity android:label="#string/app_name" android:name="MainActivity">
<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:mimeType="text/calendar" />
<data android:scheme="webcal" />
<data android:pathPattern=".*.ics" />
</intent-filter>
</activity>
<activity android:name="OptionsActivity"></activity>
<activity android:name="DetailActivity"></activity>
<activity android:name="AboutActivity"></activity>
</application>
</manifest>
I'm trying to create an Android app that needs to use OAuth to authenticate (with the Google Wave data API)
I've specified a custom scheme in my AndroidManifest.xml so that any views to a url beginning "braindump://" should go to my app:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.enigmagen.braindump"
android:versionName="0.1"
android:versionCode="1">
<uses-sdk android:minSdkVersion="7"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="true">
<activity
android:name=".BrainDump"
android:label="#string/app_name"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="braindump" />
</intent-filter>
</activity>
</application>
</manifest>
All that happens though is that after the redirect, the browser address shows the correct URL, but the page content is
You do not have permission to open this page.
braindump://rest_of_address_here
Is there a specific permission that needs to be set to allow this sort of behaviour?
I had the exact same problem (OAuth) and this is how I fixed it.
I've separated my Main from the class that will act on the URI.
Here's how the AndroidManifest.xml should look like:
<?xml version="1.0" encoding="utf-8"?>
[snip]
<activity android:label="#string/app_name" android:name="MainActivity">
<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="OAUTHActivity">
<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="myscheme" android:host="oauth" />
</intent-filter>
</activity>
</application>
[/snip]
And I was able to open URIs like myscheme//oauth?oauth_verifier=xxx&oauth_token=yyy
Actually, it's possible to do it with only one activity, just creating one more intent filter. Like this:
<activity android:name=".MyActivity"
android:label="#string/app_name">
<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="my_scheme" android:host="my_app_host.com" />
</intent-filter>
</activity>
I don't think this is exactly the cause of your problem, but I got this same error "You do not have permission to open this page" and it was because I was using a scheme with a capital letter. eg "Celly" instead of "celly". This worked fine in the emulator but failed on real devices. Changing it all to lowercase fixed it.
According to the common tasks that should be:
<scheme android:name="braindump" />