Titanium for Android: processing SEND intent keeps timing out -
i'm new android development -- working on first app android, using titanium.
i'm running problem app keeps timing out, can't figure out why. have feeling there fundamentally wrong in approach / understanding of how titanium & android work, haven't been able figure out yet.
my app bookmarking tool, similar delicious android. it:
- hooks send intent, capture sharing intents other apps
- takes subject , text send intent, , processing parse out url , title
- passes data web page
the code follows:
in /platform/android/androidmanifest.xml
, add intent filter capture send action:
<activity android:name=".advocateio2activity" android:label="advocate.io" android:configchanges="keyboardhidden|orientation"> <intent-filter> <action android:name="android.intent.action.send" /> <category android:name="android.intent.category.default" /> <data android:mimetype="text/plain" /> </intent-filter> </activity>
and in /resources/app.js
, check send intent, process, , open special url:
(function() { var baseurl = "http://mydomain.com/bookmarklet"; var intent = ti.android.currentactivity.getintent(); var win = ti.ui.createwindow({ backgroundcolor: '#000', fullscreen: false, exitonclose: true, layout: "vertical" }); if (intent.hasextra(ti.android.extra_text)) { win.open(); var title = intent.getstringextra(ti.android.extra_subject); var body = intent.getstringextra(ti.android.extra_text).replace(/\n/g, " "); var parts = body.split(" "); (var i=0; i<parts.length; i++) { if (parts[i].search(/htt*/) == 0) { // url var url = parts[i]; var bookmarklet_url = baseurl + '?url=' + encodeuricomponent(url) + '&title=' + encodeuricomponent(title) + '&mobile=1'; } } if (bookmarklet_url) { ti.platform.openurl(bookmarklet_url); } win.close(); } })();
that's whole app. simple idea.
when debug , install directly (via titanium studio) works fine, when publish play store, app crashes every time.
the app hangs when processing send intent (after i've chosen app "share" menu) -- delivering black screen. if run debug session, see there's activity idle timeout activityrecord
happening, i'm not sure why.
my guess don't how flow works in android apps, , i'm leaking memory, spawning infinite loop, or not managing application views/windows correctly.
in case, i'm stuck -- have been debugging on week , can't consistent results.
any majorly appreciated.
thanks!!
Comments
Post a Comment