// r(20814): /data/local/tmp/AndroidNFCBroadcastReceiver.Activities-debug.apk (at Binary XML file line #16): // <receiver> does not have valid android:name // Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED] // http://stackoverflow.com/questions/16645632/programmatic-vs-static-broadcast-recievers-in-android // http://stackoverflow.com/questions/4853622/android-nfc-tag-received-with-broadcastreceiver // http://stackoverflow.com/questions/6829655/nfc-broadcast-problem // You can't capture those intents with a BroadcastReceiver, because only Activities // can receive NFC intents. You can find more information about it in the NFC guide. public override void onReceive(Context arg0, Intent arg1) { var context = ThreadLocalContextReference.CurrentContext; var action = arg1.getAction(); Console.WriteLine("AtDiscovered " + new { action }); }
public override void onReceive(Context arg0, Intent intent) { Log.d(TAG, "!@#!@ConsoleReceiver action:" + intent); if (intent.getAction() == CONSOLE_INTENT) { // Unity apps will not have a VrActivity, so they can only use console functions that are ok // with a NULL appPtr. if (activity is VrActivity) { nativeConsoleCommand(((VrActivity)activity).appPtr, intent.getStringExtra(CONSOLE_STRING_EXTRA)); } else { nativeConsoleCommand(((long)0), intent.getStringExtra(CONSOLE_STRING_EXTRA)); } } }
protected override void onNewIntent(Intent intent) { var commandString = getCommandStringFromIntent(intent); var fromPackageNameString = getPackageStringFromIntent(intent); var uriString = getUriStringFromIntent(intent); Log.d(TAG, "action:" + intent.getAction()); Log.d(TAG, "type:" + intent.getType()); Log.d(TAG, "fromPackageName:" + fromPackageNameString); Log.d(TAG, "command:" + commandString); Log.d(TAG, "uri:" + uriString); nativeNewIntent(appPtr, fromPackageNameString, commandString, uriString); }
public override int onStartCommand(Intent intent, int flags, int startId) { base.onStartCommand(intent, flags, startId); // intent should be created with // getShowIntent(), getHideIntent(), getCloseIntent() if (intent != null) { string action = intent.getAction(); int id = intent.getIntExtra("id", DEFAULT_ID); // this will interfere with getPersistentNotification() if (id == ONGOING_NOTIFICATION_ID) { throw new System.Exception( "ID cannot equals StandOutWindow.ONGOING_NOTIFICATION_ID"); } if (ACTION_SHOW == action || ACTION_RESTORE == action) { show(id); } else if (ACTION_HIDE == action) { hide(id); } else if (ACTION_CLOSE == action) { close(id); } else if (ACTION_CLOSE_ALL == action) { closeAll(); } else if (ACTION_SEND_DATA == action) { if (!isExistingId(id) && id != DISREGARD_ID) { //Log.w(TAG, // "Sending data to non-existant window. If this is not intended, make sure toId is either an existing window's id or DISREGARD_ID."); } Bundle data = intent.getBundleExtra(XStandOutWindow_data); int requestCode = intent.getIntExtra("requestCode", 0); //@SuppressWarnings("unchecked") Class fromCls = (Class)intent.getSerializableExtra(XStandOutWindow_fromCls); int fromId = intent.getIntExtra("fromId", DEFAULT_ID); onReceiveData(id, requestCode, data, fromCls, fromId); } } else { //Log.w(TAG, "Tried to onStartCommand() with a null intent."); } // the service is started in foreground in show() // so we don't expect Android to kill this service return START_NOT_STICKY; }