android - Application Error: The protocol isn't supported (cedemo://com.example.scheme.MainActivity) -
i want launch android app phonegap using custom url scheme.my phonegap web link<a href="cedemo://com.example.shcema.mainactivity">launch application</a>
it manifest file:
<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.default" /> <data android:scheme="cedemo" android:host="com.example.shcema.mainactivity"/> </intent-filter> </activity>
it main activity:
public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); }}
but when click "launch application" link alert. please, me one.
you missed category_browsable in intent-filter
.
quote android docs:
activities can safely invoked browser must support category. example, if user viewing web page or e-mail , clicks on link in text, intent generated execute link require browsable category, activities supporting category considered possible actions. supporting category, promising there nothing damaging (without user intervention) can happen invoking matching intent.
so intent-filter
must like:
<intent-filter> <data android:scheme="cedemo" android:host="com.example.shcema.mainactivity"/> <action android:name="android.intent.action.view"/> <category android:name="android.intent.category.browsable"/> <category android:name="android.intent.category.default"/> </intent-filter>
see more @ : make link in android browser start app?
Comments
Post a Comment