Bug 726335 - Add support for receiving URLs via Android Beam. r=mfinkle

This commit is contained in:
Kartikaya Gupta 2013-03-05 13:05:52 +00:00
parent d592b4c61f
commit 281ff270bc
2 changed files with 21 additions and 1 deletions

View File

@ -42,6 +42,10 @@
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen"/>
<!-- Android Beam support -->
<uses-permission android:name="android.permission.NFC"/>
<uses-feature android:name="android.hardware.nfc"/>
#ifdef MOZ_WEBRTC
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-feature android:name="android.hardware.audio.low_latency" android:required="false"/>
@ -120,6 +124,13 @@
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />

View File

@ -27,6 +27,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.Rect;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
@ -1210,8 +1211,16 @@ abstract public class BrowserApp extends GeckoApp
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (!Intent.ACTION_MAIN.equals(intent.getAction()) || !mInitialized)
String action = intent.getAction();
if (Build.VERSION.SDK_INT >= 10 && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
String uri = intent.getDataString();
GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(uri));
}
if (!Intent.ACTION_MAIN.equals(action) || !mInitialized) {
return;
}
(new UiAsyncTask<Void, Void, Boolean>(GeckoAppShell.getHandler()) {
@Override