forked from jens/Automation
StartAppChanges
This commit is contained in:
parent
1c24af7bcb
commit
8843a97b79
@ -589,6 +589,8 @@ public class Actions
|
|||||||
else
|
else
|
||||||
externalActivityIntent.setClassName(packageName, className);
|
externalActivityIntent.setClassName(packageName, className);
|
||||||
|
|
||||||
|
if(Miscellaneous.doesActivityExist(externalActivityIntent, Miscellaneous.getAnyContext()))
|
||||||
|
{
|
||||||
// has intent values to deliver
|
// has intent values to deliver
|
||||||
for (int i = 2; i < params.length; i++)
|
for (int i = 2; i < params.length; i++)
|
||||||
{
|
{
|
||||||
@ -660,6 +662,11 @@ public class Actions
|
|||||||
|
|
||||||
autoMationServerRef.startActivity(externalActivityIntent);
|
autoMationServerRef.startActivity(externalActivityIntent);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("w", "StartOtherApp", "Activity not found: " + className, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
catch(ActivityNotFoundException | SecurityException e)
|
catch(ActivityNotFoundException | SecurityException e)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("e", "StartOtherApp", autoMationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + Log.getStackTraceString(e), 2);
|
Miscellaneous.logEvent("e", "StartOtherApp", autoMationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + Log.getStackTraceString(e), 2);
|
||||||
|
@ -7,6 +7,7 @@ import android.app.NotificationChannel;
|
|||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
|
import android.content.ContentProvider;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
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();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user