• Announcements

    • Shane D.

      Announcing 'Spaces' for Evernote Business!   02/27/2018

      Hi All, We're very excited to announce the launch of Spaces for Evernote Business! I invite you to find more details and learn more in our most recent Community Announcement! 
    • Shane D.

      Code of Conduct   03/26/2018

      Hi All, The updated version of the Code of Conduct has been implemented, and you will need to accept those terms before proceeding. If you would like to review the Code of Conduct, you can do so Here
    • Shane D.

      Update to Evernote Subscription Plans   04/12/2018

      Hi All, We've made some updates to our Evernote subscription plans. To learn more, please see the 'Update to Evernote Subscription Plans' thread in the Community Announcements forum, or you can go here.
JamesT

Android Intents local API

Recommended Posts

Hi,

I am trying to use the Android Intents to launch the create Note action.

At the moment I need to support two features:

  1. Plain text note creation
  2. Accept a prebuilt enex file that will be passed via the intent.

However, I can't find the relevant documentation to explain what I need to do.

I have tried the following :


Intent sendIntent = new Intent("com.evernote.action.CREATE_NEW_NOTE");
sendIntent.putExtra(Intent.EXTRA_TITLE, "Web Clip");
sendIntent.putExtra(Intent.EXTRA_TEXT, fullContents);
sendIntent.setType("text/plain");
startActivity(sendIntent);

But the UI is not launched.

I have included the Evernote libs in my project (not sure I actually need to do this though?

The documentation I have been looking at is at this link:

http://dev.evernote....rs/android.php

What am I missing? I do not want to use the cloud API, and supporting the intents is all I need to do.

UPDATE

I have managed to get the above to work. I still need to be able to get the enex file working. I'm currently getting a NullPointerException from the Evernote fragment:


02-03 21:07:33.387: ERROR/NewNoteFragment(9601): java.lang.NullPointerException
java.lang.NullPointerException
at android.content.ContentResolver.openInputStream(ContentResolver.java:433)
at com.evernote.ui.NewNoteFragment.a(NewNoteFragment.java:2193)
at com.evernote.ui.QuickSaveFragment.e(QuickSaveFragment.java:97)
at com.evernote.ui.pp.run(QuickSaveFragment.java:83)
at java.lang.Thread.run(Thread.java:856)

Using something like the following:


File myFile = new File("/sdcard/mysdfile.txt");
FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(EnexOutput.convertToString(note));

osw.flush();
osw.close();

Intent evernote = new Intent();
evernote.setAction(Intent.ACTION_SEND);
evernote.setData(Uri.parse("file:///sdcard/mysdfile.txt"));
evernote.setType("application/enex");
startActivity(evernote);

Share this post


Link to post