Getting UID of NDEF tag when scanning NFC tag with AAR Android Studio - android-studio

The problem i'm having is i'm trying to open an app when I scan the NFC card, and pass in data to the app immediately. All I need passed in is the ID of the card. I already have this working, kind of. In NFC Tools I add an AAR (Add Application Record) and add the package name, and this opens the app. In my code in android studio I have the following intent
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
And in my main activity I have
override fun onResume() {
super.onResume()
UIDLabel.setText(intent.action.toString())
if (NfcAdapter.ACTION_NDEF_DISCOVERED == intent.action) {
val tag = intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)
UIDLabel.setText((ByteUtils.bytesToHex(tag!!.id)))
}
}
This does return my UID of the Tag but I also need to have a Text record added to the card for it to work (Obviously because the intent-filter is looking for "text/plain". What i'm trying to do is achieve the same results just without the Text having to be added to the card. I've experimented with different intent-filters and nothing works. Does anyone know what intent-filter I should use in this situation? Thanks

Related

Android studio - Complete operation with "app" (Open .txt file with the app)

the thing I want to do is to share a txt file through whatsapp and open it with my app, converting datas written in it, to be able to use them in the application.
I've read something about the "BroadcastReceiver", but what I found didn't work as well.
I attach a pic to let you understand better,
thank you for help!
picture
I resolved, in manifest, inside the activity:
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>

Automation Steps not firing for custom screen?

I have used automation steps to add an action menu to an existing screen, add approval automation and other automations to an existing screen, and control fields/values of existing screens. Each of those cases appear to work fine. However, I have added a new custom screen that does not require approvals, and automation steps seem to do nothing for me other than adding an action item to the menu.
What would prevent my custom screen from executing my simple automation steps? I have 1 view set as the data member for both the form and tab in a form/tab screen used to break up the data to keep the data simple for the end user to view. The only thing working is that the Action menu option "Convert to Repair" is added to the screen, although it is not disabled as intended nor the status updated when the hold checkbox is changed.
Automation Definition:
<?xml version="1.0" encoding="utf-8"?>
<Screens>
<Screen ScreenID="ZI302000">
<Step StepID="Hold -> Open" Description="Hold -> Open" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="False" Value2="False" Operator="And" />
<Filter FieldName="Status" Condition="Equals" Value="H" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="O" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
<Step StepID="On Hold" Description="On Hold" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="True" Value2="False" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="H" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair" IsDisabled="1">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
</Screen>
</Screens>
As it turns out, it seems the automation steps referenced a node id of an earlier version of the page. After experimenting with some formatting of the page, I removed it and started over. By not removing the old automation steps entirely, the system was firing automation for a page referenced by an outdated node id.
Solution: Delete the automation steps entirely and start over. In my case, I deleted the automation definition as well because I had tried deleting the automation steps before but not the automation definition with no success. I also deleted the site map to the page, the files from the customization project, the files from the OS, and recreated it all from scratch. Once confirmed that automation steps were working on the newly recreated page, I was able to go to a backup copy of the aspx file and paste the contents into my new page aspx file in the customization project to restore all my work on the layout and settings.

Idea intellij plugin not working in android studio 1.5.1

I'm developing a test plugin for android studio, my plugin works (The actions created are visible ) in Android studio 1.5 when added using "install plugin from disk". But the same jar file is not working in Android studio 1.5.1.
Below is the plugin.xml file. Please help.
<idea-plugin version="2">
<id>com.test.android.studio.plugin</id>
<name>test Android Studio Plugin</name>
<version>1.0</version>
<vendor email="test#test.com" url="http://www.test.com">test test Services Pvt. Ltd.</vendor>
<description>
Android Studio plugin to integrate test SDK
</description>
<change-notes>
Release 0.0.1: Initial release.
</change-notes>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="131"/>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<!-- uncomment to enable plugin in all products-->
<depends>com.intellij.modules.lang</depends>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
</extensions>
<actions>
<!-- Add your actions here -->
<group id="Test" class="org.test.plugin.actions.TestMainActionGroup" text="Test" description="Main Test invocation Action"
popup="true">
<add-to-group group-id="MainMenu" anchor="last"/>
<action id="testMode" class="org.Test.plugin.actions.TestModeAction" text="Test Mode" description="Test mode action">
<keyboard-shortcut keymap="$default" first-keystroke="ctrl k"/>
</action>
<action id="invocationCode" class="org.Test.plugin.actions.InvocationCodeAction" text="Invocation Code"
description="Test mode action">
</action>
<action id="onlineDoc" class="org.Test.plugin.actions.OnlineDocAction" text="Online Documentation"
description="Test mode action">
</action>
<action id="aboutUs" class="org.Test.plugin.actions.AboutUsAction" text="About Us" description="Test mode action">
</action>
</group>
</actions>
As the other answer already pointed out the problem is caused by using a custom group class for the action group.
When you may need custom action group?
A Custom action group is needed only if you have some custom logic that controls the behavior of your group of actions, such as the group should be enabled on some selection in the editor,or on mouse hover ,or if you want to add actions dynamically to the group etc.
If the purpose of group is to group the predefined actions and display it in a particular location the default action group is all that you need
and it can be easily accomplished by following lines
<group id="Test" text="Test" description="Main Test invocation Action"
popup="true">
<add-to-group group-id="MainMenu" anchor="last"/>
<!--List of predefined actions here -->
</group>
Note that the class attribute from the group tag is removed. Now the IDE considers its group as Default Action Group.
The problem is caused by using a custom group class for the action group you add to the main menu. This is not supported in some versions of IntelliJ IDEA/Android Studio.

How do you get the hardware back button on VideoCastControllerActivity to work?

Once my app starts playing and VideoCastControllerActivity shows up, the hardware back button won't take it back to my activity. The actionbar back button works just fine. I don't see any errors on the logs or anything and looking at the VideoCastControllerActivity I didn't see anything obvious trying to capture the back button behaviour or anything. To start it I am calling startCastControllerActivity.
Here is the chunk of my manifest declaring it:
<activity
android:name="com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:parentActivityName="com.mypackage.myactivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.mypackage.myactivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
Thanks.
The CastCompanionLibrary doesn't try to capture the back button at all, so it should work just fine. Please try the CastVideos-andrid (which uses that library) to confirm that.

actionbarsherlock getSupportActionBar() return null in android4.0,but in 2.3.3 is ok

application use actionbarsherlock,but main activity get getsupportactionbar returns null.
AndroidManifest.xml:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Light1Theme" >
<activity
android:name=".activity.LogonActivity"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="adjustUnspecified|stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
themes.xml:
<style name="Light1Theme" parent="Theme.Sherlock.Light">
LogonActivity.ava
extends SherlockActivity implements OnSharedPreferenceChangeListener {
...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.logon);
try{
final ActionBar ab = getSupportActionBar();
//return null
ab.setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_black));
getSupportActionBar().setIcon(R.drawable.hospital);
}catch(Exception e){
Log.e("", e.getMessage());
}
I was facing this same issue a few hours ago, and it turned out, the root of the problem was that I used a theme with no title bar.
This reply from Jake Wharton, the developer of actionbarsherlock will help you sort it out.
In short: on android versions ICS and newer, setting the attribute android:windowNoTitle will affect the action bar's display (as it is a core feature in those versions).
The ABS has wrapped it into windowNoTitle (with no namespace / default abs namespace), so depending on the android version your application is installed on, you will get the proper display.
If you have the line
<item name="android:windowNoTitle">true</item>
in your style definition, just change it to
<item name="windowNoTitle">true</item>
or completely leave it out / remove it from your theme (abs will handle it correctly!)
I was facing this same issue now , and I found that use android:theme="#style/Theme.Sherlock" is enough.
if you use
<item name="windowNoTitle">true</item>
or
<item name="android:windowNoTitle">true</item>
It will crash application , may be Jake fix this in Theme.Sherlock.
So Here is my solution now:
<application
android:name="XXXXApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
And it works well on ICS+ and pre-ICS , test on android 2.3.5,2.3.7,CM7 , android 4.0,4.1
In my case, I face this issue when I set the theme android:theme="#style/Theme.Sherlock.NoActionBar", then call getSupportActionBar() to get the actionbar. If you want to manage the action bar, just turn the them to android:theme="#style/Theme.Sherlock.
I had the same problem. I have simple removed below line of code and its work like a charm.
requestWindowFeature(Window.FEATURE_NO_TITLE);

Resources