0

Phonegap Application lunching Problem

it is 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 is my main activity:

public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);     
}}

But when I click "Launch Application" link then i get this alert. enter image description here

please, help me any one.

nurealam11
  • 537
  • 4
  • 16

2 Answers2

0

You missed CATEGORY_BROWSABLE in your intent-filter.

Quote from Android Docs:

Activities that can be safely invoked from a browser must support this category. For example, if the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions. By supporting this category, you are promising that there is nothing damaging (without user intervention) that can happen by invoking any matching Intent.

So your intent-filter must be 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 at : Make a link in the Android browser start up my app?

Community
  • 1
  • 1
turtle
  • 1,599
  • 1
  • 12
  • 27
0

This won't work. because how Android can know which App I've start on this custom URI call?

So you first have to let the android know that a custom URI exists which can receive such calls and then whenever that custom URI is invoked by any app either native or hybrid, OS will automatically forward it to the registered app i.e. able to receive such calls.

Read this Android docs tutorial:

Allowing Other Apps to Start Your Activity http://developer.android.com/training/basics/intents/filters.html

Here is an example how one app can call other app. Launch an application from another application on Android

And here is custom plugin which makes easier to open another app from the Cordova/phonegap App.

https://github.com/lampaa/org.apache.cordova.startapp

Community
  • 1
  • 1
AAhad
  • 2,739
  • 1
  • 23
  • 42