Pierre Hébert​​ How should I construct an Intent to run a script in Background?

Pierre Hébert​​ How should I construct an Intent to run a script in Background?

Edit: More specifically I would like to construct an PendingIntent.

]]>

5 Commentsto Pierre Hébert​​ How should I construct an Intent to run a script in Background?

  1. Anonymous says:

    < ![CDATA[

    Will be needing this soon.. I hope its possible.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    This must be an intent with action “com.twofortyfouram.locale.intent.action.FIRE_SETTING” and component set to app_package_name/net.pierrox.lightning_launcher.util.FireReceiver (only setting the package name might work too)



    The intent will have an extra “com.twofortyfouram.locale.intent.extra.BUNDLE” of type Bundle.



    In this bundle there need to be these data:


    “a” : EventHandler.RUN_SCRIPT (integer)


    “d”: script_id/script_data or script_id (string)


    “t”: 0 for desktop, 1 for app drawer, 2 for lockscreen, 3 for background (integer)

    ]]>

  3. Anonymous says:

    < ![CDATA[

    I don’t know why, but I seem to never get a callback of this:




    var intent = new Intent(“com.twofortyfouram.locale.intent.action.FIRE_SETTING”);


    intent.setClassName(ctx.getPackageName(),”net.pierrox.lightning_launcher.util.FireReceiver”);


    var b= new Bundle();


    b.putInt(“a”,EventHandler.RUN_SCRIPT);


    b.putString(“d”,script.getId().toString());


    b.putInt(“t”,3);


    intent.putExtra(“com.twofortyfouram.locale.intent.extra.BUNDLE”,b);


    var p = PendingIntent.getBroadcast(ctx,0,intent,0);


    var cal = Calendar.getInstance();


    cal.clear(Calendar.HOUR_OF_DAY);


    cal.clear(Calendar.MINUTE);


    var am = ctx.getSystemService(Context.ALARM_SERVICE);


    am.cancel(p);


    am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,cal.getTimeInMillis(),(interval/steps)*60000,p);

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Got it. Had to use RTC instead of ELAPSED_REALTIME.

    ]]>

  5. Anonymous says:

    < ![CDATA[

    TrianguloY​ totally forgot about this. That’s the way it should work in the Repository importer.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *