So, I am trying to get the url that is being called in my application, but after opening it, it always seems to be nullunimportant what I do.
Here is the relevant part of my manifest:
<activity android:name="myapp" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="myapp" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
And here is my java:
@Override
public void onStart() {
super.onStart();
final Intent intent = getIntent();
Uri url = intent.getData();
Log.e("myLog", "Url = " + url);
}
The log shows "Intent = null" and I have no errors.
I am not a Java developer, so I may have a simple problem that I will not recognize. I am going to transfer this to my PhoneGap application using sendJavascript, but the PhoneGap application does not look like this problem.
EDIT:
It seems I only get the first <intent-filter>one when I record intent. Here is the log:
03-13 12:36:18.593: E/MyAppLog(13793): Intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.wd.myapp/.myapp (has extras) }
DECISION:
, URL, PhoneGap, , , - .
: AndroidManifest.xml - <intent-filter> <activity>, 'urlScheme' , . urlScheme:///? Key = val .
<intent-filter>
<data android:scheme="urlScheme" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
: myApp.java - onCreate. singleTask, intent onStart ( onCreate, ), , .
@Override
public void onStart() {
super.onStart();
final Intent intent = getIntent();
String url = intent.getDataString();
if(url != "" && url != null) {
super.sendJavascript("setTimeout(function() { handleOpenURL('" + url + "'); },1);");
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent); setIntent(intent);
}
. onNewIntent.