StartAppChanges

This commit is contained in:
jens 2021-04-13 20:00:36 +02:00
parent 1c24af7bcb
commit 8843a97b79
2 changed files with 70 additions and 57 deletions

View File

@ -589,6 +589,8 @@ public class Actions
else
externalActivityIntent.setClassName(packageName, className);
if(Miscellaneous.doesActivityExist(externalActivityIntent, Miscellaneous.getAnyContext()))
{
// has intent values to deliver
for (int i = 2; i < params.length; i++)
{
@ -660,6 +662,11 @@ public class Actions
autoMationServerRef.startActivity(externalActivityIntent);
}
else
{
Miscellaneous.logEvent("w", "StartOtherApp", "Activity not found: " + className, 2);
}
}
catch(ActivityNotFoundException | SecurityException e)
{
Miscellaneous.logEvent("e", "StartOtherApp", autoMationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + Log.getStackTraceString(e), 2);

View File

@ -7,6 +7,7 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentProvider;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -1327,4 +1328,9 @@ public class Miscellaneous extends Service
Toast.makeText(context, "Request failed try again: "+ t.toString(), Toast.LENGTH_LONG).show();
}
}
public static boolean doesActivityExist(Intent intent, Context context)
{
return intent.resolveActivityInfo(context.getPackageManager(), 0) != null;
}
}