For several reasons I don't want to use the Google Play mechanism to upgrade an android application. So I decided to make my own system to download and upgrade an android application.
Step 1: download the update .apk
file.
Step 2: put a button in the original application so a user can click on it to start the .apk
for upgrade.
The following code is giving me an error.
procedure TfrmUpdateProgram.DoUpgrade;
{$IF DEFINED(IOS) or DEFINED(ANDROID)}
var Intent : JIntent;
{$ELSE}
{$ENDIF}
begin
{$IF DEFINED(IOS) or DEFINED(ANDROID)}
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
Intent.setDataAndType(StrToJURI(newAPKFile), StringToJString('application/vnd.android.package-archive'));
SharedActivityContext.startActivity(Intent);
Application.Terminate;
{$ELSE}
ShellExecute(0, PWideChar('Open'), PWideChar(newAPKFile), nil, nil, SW_HIDE);
{$ENDIF}
end;
android.content.activitynotfoundexception: No activity found to handle intent {act=android.intent.action.view dat=/storage.....update.apk typ=application/vnd.android.package-archive flg=0x1000000}
Any thoughts?