Jump to content

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

Photo

Unable to create enml formatted note using Android intent

android intent enml enex

  • Please log in to reply
8 replies to this topic

#1 ScottU

ScottU

  • Pip
  • Title: Member
  • Group: Members
  • 7 posts

Posted 30 June 2012 - 03:52 AM

Hello...

I'm unable to create a enml formatted note using the android intent described in the local api documentation and as shown in the sample code. Here are details. Does anyone have any ideas that may help?

Thanks in advance!

Scott

This problem is also mentioned by a few people at http://discussion.ev...intent-problem/. Once you select Evernote from the app chooser the screen turns black and just hangs there in Evernote.

I'm running 2.3.5 on a samsung galaxy s with Evernote 4.0.4.

Here's the code:

Uri uri = Uri.fromFile(file);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setDataAndType(uri,""application/enex");
startActivity(Intent.createChooser(intent, "Share with:"));
The file contents of note.enex:

$ pwd
/mnt/sdcard/data/com.evercite/files
$ cat note.enex
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export.dtd&quot;><en-export><note><title>title</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd&quot;><en-note>
content
</en-note>
]]></content></note></en-export>
$


From the log:
I/ActivityManager(109): Starting: Intent { act=android.intent.action.SEND dat=file:///mnt/sdcard/data/com.evercite/files/note.enex typ=application/enex flg=0x3000000 cmp=com.evernote/.note.composer.NewNoteActivity } from pid 2135
The first problem I see after calling the intent is

06-28 23:15:44.988: I/com.evernote.Evernote(2145): +++++++++openOrCreateDatabase()::start/mnt/sdcard/Evernote/.external-1322600773132-Evernote.db
06-28 23:15:44.988: I/com.evernote.Evernote(2145): ::evernoteSDcardPath=/mnt/sdcard/Evernote
06-28 23:15:44.988: E/com.evernote.Evernote(2145): ::stack trace=
06-28 23:15:44.992: E/com.evernote.Evernote(2145): java.io.IOException
06-28 23:15:44.992: E/com.evernote.Evernote(2145): at com.evernote.Evernote.openOrCreateDatabase(Evernote.java:283)
06-28 23:15:44.992: E/com.evernote.Evernote(2145): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
Then the synch fails a couple of times further down in the log and hangs.

Ilog attached

Attached Files

  • Attached File  log.txt   33.98K   0 downloads


#2 ScottU

ScottU

  • Pip
  • Title: Member
  • Group: Members
  • 7 posts

Posted 03 July 2012 - 11:57 AM

I have a ticket open for this issue. Unfortunately I needed this last night for the dev cup. I spent yesterday afternoon putting in the cloud api and it works great!

#3 ping13

ping13

  • PipPipPip
  • Title: Bushwhacker
  • Group: Members
  • 107 posts

Posted 05 July 2012 - 05:22 AM

I haven't really not delved into your code, but I think your ENML code is wrong (should be at least enml2.dtd). Check http://enml-editor.ping13.net to see the proper ENML code of one of your notes.
--
Reveal your hidden notes with NotePlaces
Edit your notes as ENML with http://enml-editor.ping13.net
Sync your Simplenote notes with Evernote at http://simpleforever.net

#4 ScottU

ScottU

  • Pip
  • Title: Member
  • Group: Members
  • 7 posts

Posted 07 July 2012 - 12:07 AM

Thanks schalker. There may be a problem there. I'll study it. I tried keeping the enml as simple as possible and just used the sample enex and enml, but still the hanging. I just avoided it altogether by going with the cloud api and wrote out the enml just fine.

#5 ping13

ping13

  • PipPipPip
  • Title: Bushwhacker
  • Group: Members
  • 107 posts

Posted 07 July 2012 - 07:19 AM

Note that ENEX is not the same as ENML. Your note's content is always in ENML. ENEX is the export format which implicitly includes image resources (and not en-media tags as in ENML, for example). So ENEX is a different beast than ENML. Check the DTDs for the differences.
--
Reveal your hidden notes with NotePlaces
Edit your notes as ENML with http://enml-editor.ping13.net
Sync your Simplenote notes with Evernote at http://simpleforever.net

#6 ScottU

ScottU

  • Pip
  • Title: Member
  • Group: Members
  • 7 posts

Posted 07 July 2012 - 02:58 PM

Thanks Schalker,

Correct, I have the enml wrapped up in enex. Per the documentation I think I should be able to send a data field through to the evernote app using the SEND intent. The data field of the intent should identify a file uri for a file that contains enex wrapped enml such as...


<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-export SYSTEM "http://xml.evernote....itle><content><![CDATA[<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote....>test</en-note>]]></content></note></en-export>


I wonder about the sqlite exception thrown right after invoking the intent in the call to com.evernote...NewNoteActivity.onResume(). Right after this exception is thrown things just start to hang up. It could be a red herring. I'm able to pass fairly complex and large enml docs into the cloud api without any problems. Since the cloud api works, I gave up on the intent.

Attached Files



#7 ping13

ping13

  • PipPipPip
  • Title: Bushwhacker
  • Group: Members
  • 107 posts

Posted 09 July 2012 - 05:26 AM

Sorry, I don't know Android or Andorid intents, so I'm not qualified to comment on this. Anyway, good luck for your project!
--
Reveal your hidden notes with NotePlaces
Edit your notes as ENML with http://enml-editor.ping13.net
Sync your Simplenote notes with Evernote at http://simpleforever.net

#8 SethH

SethH

  • Title: Evernote Employee
  • Group: Evernote Employee
  • 683 posts

Posted 13 July 2012 - 04:38 PM

Hey Scott, I think that our ENEX intent has a bug in it at the moment. Sorry about that, I'll keep you posted about progress.

#9 ScottU

ScottU

  • Pip
  • Title: Member
  • Group: Members
  • 7 posts

Posted 13 July 2012 - 07:00 PM

Great, Thanks Seth!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Clip to Evernote