You can create an Intent from this URI using parseURI function:
1. Action -> Code -> Java Function
Class or Object: Spyglass -> filter "intent" -> Choose Class - Intent (android.content)
Function: Spyglass -> parseURI {Intent} (String, int)
Return {Intent} -> myIntent
Param(String): intent:#Intent;action=android.intent.action.INSERT;category=android.intent.category.DEFAULT;type=vnd.android.cursor.dir/raw_contact;launchFlags=0x13000000;S.phone=%2B1234325346;S.name=Mike;end
Param(int): 318767104 (Decimal value of hexadecimal 13000000 above)
The value is an
ArrayList. Each item can be:
I have Android version 4.2.2, so it creates the alarm only for current day. Download it and try. You can find the string version of this intent in VARS -> %URI
#Intent;action=android.intent.action.SET_ALARM;launchFlags=0x12000000;i.android.intent.extra.alarm.HOUR=9;i.android.intent.extra.alarm.MINUTES=11;S.android.intent.extra.alarm.MESSAGE=Get%20up!;end
Java code is executed with a non-UI thread by a service.
Some implications are:
- things which require an activity will not work e.g. showing a dialog
- sending intents will in some cases require the flag Intent.FLAG_FROM_BACKGROUND and possibly also Intent.FLAG_ACTIVITY_NEW_TASK
Static fields (e.g. ContentResolver.EXTRA_SIZE) are not currently supported by Tasker.
A workaround is to use reflection to get (or set) the value:
res = CONTEXT.getContentResolver();
cls = res.getClass();
fld = cls.getField( EXTRA_SIZE );
%val = fld.get( null );
8. You need some flags for this to work (pay attention to Param(int) field)
Action -> Code -> Java Function
Class or Object: Coffee cup -> myIntent
Function: Spyglass -> filter "flag" -> addFlags {Intent} (int)
Return {Intent} -> nothing
Param(Int): myIntent.FLAG_ACTIVITY_FORWARD_RESULT
9. You need some flags for this to work (pay attention to Param(int) field)
Action -> Code -> Java Function
Class or Object: Coffee cup -> myIntent
Function: Spyglass -> filter "flag" -> addFlags {Intent} (int)
Return {Intent} -> nothing
Param(Int): myIntent.FLAG_ACTIVITY_NEW_TASK
So these static fields in your example may not correct, e.g. "FLAG_ACTIVITY_FORWARD_RESULT",
I think this will be very useful!
I found the URI for the intent I want to use with the Intercept Intent app. I replaced the URI in your example, but now it throws an error. The URI I want to use is below. Any ideas?
intent:#Intent;action=android.intent.action.SENDTO;type=vnd.google.android.hangouts/vnd.google.android.hangout_privileged;package=uk.co.ashtonbrsc.android.intentintercept;S.participant_gaia=##############;S.participant_name=First%20Last;S.android.intent.extra.TEXT=Test;S.account_name=first.last%40gmail.com;end
############## = a long number (recipient's unique ID?)
First%20Last = name of recipient
first.last%40gmail.com = sender's email
Thanks for writing this awesome guide!