Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26744] Hyperloop : Add support for accessing Titanium SDK inbuilt Android classes

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2020-09-17T01:43:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterPrashant Saini
AssigneeEric Merriman
Created2018-12-14T06:45:05.000+0000
Updated2020-09-17T01:43:27.000+0000

Description

Accessing SDK classes like below gives null results using Hyperloop. {noformat} var IntentProxy = require('org.appcelerator.titanium.proxy.IntentProxy'); // IntentProxy is null always {noformat} Many times we need these classes to do native things in Hyperloop like defining interfaces, casting Titanium objects to native objects and much more. This requirement came up when I was trying to call a third-party library intent like below: {noformat} var libIntent = SomeThirdPartyLib.getActivity().getIntent(); Ti.Android.currentActivity.startActivityForResult(libIntent, function() {}); // Above call crashes the app throwing this error: // [ERROR] : zygote: JNI ERROR (app bug): attempt to pass an instance of hyperloop.InstanceProxy as argument 1 to void org.appcelerator.titanium.proxy.ActivityProxy.startActivityForResult(org.appcelerator.titanium.proxy.IntentProxy, org.appcelerator.kroll.KrollFunction) {noformat} So I had 2 options to achieve what I wanted to do: * Either cast native Android Intent into a Titanium Intent and use it in Titanium's *startActivityForResult* method call to get the results back in passed callback function. Unfortunately this is not possible at present anyhow. * Use native Android Activity's *startActivityForResult* method with the native Intent but then we cannot get the results back as we do not have any onActivityResult method available on Titanium Activity. However, I am not sure whether having the access to Ti SDK classes will solve this problem, but seems that *Solution #2* might work if we have support for *onActivityResult* method on Titanium Activity.

Comments

  1. Joshua Quick 2020-09-17

    This was implemented in Titanium 9.0.0 via [TIMOB-27297].

JSON Source