All I want is to install (ask user for) new application version stored on sdcard as .apk file using Adobe Air Native Extension.
Here is my ANE function code:
@Override
//args[0] is the path to local stored apk (logs as /storage/sdcard0/testStorage/updates/1.1apk)
public FREObject call(FREContext _context, FREObject[] args) {
context = _context;
try {
Intent promptInstall = new Intent(Intent.ACTION_VIEW);
promptInstall.setDataAndType(Uri.parse(args[0].getAsString()), "application/vnd.android.package-archive");
promptInstall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.getActivity().startActivity(promptInstall);
alert("Okay", "start was!"); //using AlertDialog for debug purpose
} catch (Exception e) {
alert("Error!", e.getLocalizedMessage());
e.printStackTrace();
}
return null;
}
And here is manifest I'm using:
<android>
<manifestAdditions><![CDATA[<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
<application android:hardwareAccelerated="true" />
<application android:debuggable="true"/>
<application>
<activity android:name="android.intent.action.VIEW">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch" />
</manifest>]]></manifestAdditions>
</android>
But I'm always getting "No activity found to handle Intent error":
No Activity found to handle Intent { act=android.intent.action.VIEW dat=/storage/sdcard0/testStorage/updates/1.1.apk typ=application/vnd.adnroid.package-archive flg=0x10000000}
Added
File setupFile = new File(args[0].getAsString());
alert("Is exists?", Boolean.toString(setupFile .exists())); //output as true
Said that file is real and args[0] path is correct.