Is it possible to launch a specific activity in an app using NFC tag?
I want to start an activity called MainMap which is not the main activity. I've tried using a tag writer for writing mime record and still failing.
Here's the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.km.parkit"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<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>
</activity>
<activity
android:name=".MainMap"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/com.km.ParkIT" />
</intent-filter>
</activity>
<activity
android:name="com.km.parkit.parka"
android:label="@string/app_name" />
<activity
android:name="com.km.parkit.parkb"
android:label="@string/app_name" />
<activity
android:name="com.km.parkit.parkc"
android:label="@string/app_name" />
<activity
android:name="com.km.parkit.parkd"
android:label="@string/app_name" />
<!-- Google Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBf-0hUDrDTK-NOveZrnT8wec5TTTLqjAw" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
I wrote the MIME type "application/com.km.parkit" into the NFC tag using https://github.com/balloob/Android-NFC-Tag-Writer
What am I missing here?
Oh my problem is that the app doesn't get started when I tap it to the NFC tag, when I tap the tag, it shows the usual popup box showing the programs which I can use to access the NFC tag or read the datas, namely NFC Tag Info and New Tag Collected.
application/com.km.parkit
(in lower case)? – Bruno Parmentierandroid.nfc.action.TECH_DISCOVERED
andandroid.nfc.action.TAG_DISCOVERED
on intent-filter action. – Héctor