Android app enable NFC only for one Activity

If you want to diable processing of NFC discovery events (NDEF_DISCOVERED, TECH_DISCOVERED, TAG_DISCOVERED) while a certain activity is in the foreground, you would register that activity for the foreground dispatch system. That activity can then ignore these events (which it would receive in its onNewIntent() method. This will prevent NFC discovery events to be delivered … Read more

How to Share Image + Text together using ACTION_SEND in android?

You can share plain text with the following code String shareBody = “Here is the share content body”; Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType(“text/plain”); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, “Subject Here”); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using))); So your full code (your image + text) becomes private Uri imageUri; private Intent intent; imageUri = Uri.parse(“android.resource://” + getPackageName() + “/drawable/” + “ic_launcher”); … Read more

Unable to start Service Intent

For anyone else coming across this thread I had this issue and was pulling my hair out. I had the service declaration OUTSIDE of the ‘< application>’ end tag DUH! RIGHT: <manifest xmlns:android=”http://schemas.android.com/apk/res/android” …> … <application android:icon=”@drawable/icon” android:label=”@string/app_name”> <activity …> … </activity> <service android:name=”.Service”/> <receiver android:name=”.Receiver”> <intent-filter> … </intent-filter> </receiver> </application> <uses-permission android:name=”…” /> WRONG … Read more

Launching custom Android application from Android browser / Chrome

You need to set it up like this : <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.DEFAULT” /> <category android:name=”android.intent.category.BROWSABLE” /> <data android:host=”example.com” android:pathPrefix=”/someresource/” android:scheme=”http” /> <data android:host=”www.example.com” android:pathPrefix=”/someresource/” android:scheme=”http” /> </intent-filter> Notice that in your case, you would need to use android:pathPrefix instead of android:path.

Intent action for network events in android sdk

Here’s a working example: <uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” /> <receiver android:name=”.receiver.ConnectivityReceiver”> <intent-filter> <action android:name=”android.net.conn.CONNECTIVITY_CHANGE” /> </intent-filter> </receiver> . public class ConnectivityReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d(ConnectivityReceiver.class.getSimpleName(), “action: ” + intent.getAction()); } }

Intercepting links from the browser to open my Android app

Use an android.intent.action.VIEW of category android.intent.category.BROWSABLE. From Romain Guy’s Photostream app’s AndroidManifest.xml, <activity android:name=”.PhotostreamActivity” android:label=”@string/application_name”> <!– … –> <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.DEFAULT” /> <category android:name=”android.intent.category.BROWSABLE” /> <data android:scheme=”http” android:host=”flickr.com” android:pathPrefix=”/photos/” /> <data android:scheme=”http” android:host=”www.flickr.com” android:pathPrefix=”/photos/” /> </intent-filter> </activity> Once inside you’re in the activity, you need to look for the action, and then … Read more