5 Replies Latest reply on Jan 24, 2018 12:01 PM by oco

    How to send data from a thrid android app to Velocity

    Rookie

      My goal is to send data to  Velocity client. For this reason I am using an intent on my custom Application. the code is the following:

       

       

      public void  SendToVelocity(View view)
      {
        Intent sendIntent = new Intent();
        sendIntent.setAction("com.wavelink.intent.action.EMDK.SEND");
        sendIntent.addCategory("android.intent.category.DEFAULT");
        sendIntent.putExtra(Intent.EXTRA_TEXT, "RFID data");
        sendIntent.setType("text/plain");
      
         if (sendIntent.resolveActivity(getPackageManager()) != null) {
        startActivity(sendIntent);
        }
      
      }
      

      However the above code does not get inside if statement. This means that it can not resolve current intent action.

      My questions are:

      1. Is the above (com.wavelink.intent.action.EMDK.SEND) action string valid for calling corresponding Velocity Action? If not what is the corrcet string?
      2. The above method would like to be called on a key press. What script to I need to write in Velocity console in order to call a method of another application?
        • 1. Re: How to send data from a thrid android app to Velocity
          Matt Dermody SSMMVPGroup

          I don't know if you can call another App from a Velocity Script but you could possibly remap a physical key at the OS level.

          • 2. Re: How to send data from a thrid android app to Velocity
            fkshelton SupportEmployee

            I am not sure if this is what your looking for but take a look at this community article and see if it might help you out.

             

            Velocity API: Action.launch()

            1 of 1 people found this helpful
            • 3. Re: How to send data from a thrid android app to Velocity
              Rookie

              I have managed to open my custom app from Velocity using Action.LaunchForResult. However I cant get the data back to Velocity inside the callback, I get intent.result=0. My script is:

               

              function sendAction(event) {
                if (event.keyCode == 97)
                {                           
                          Action.launchForResult({
                            action:'.android.intent.action.SEND',
                            class:'com.example.bedev.alientest.MainActivity',
                            categories:['android.intent.category.DEFAULT'],
                            package:'com.example.bedev.alientest'     
                          },
                          function (intent) {                               
                          Device.beep(500,400,0);
                          var data;
                          Device.sendKeys(intent.result);  //display result on Server for debug purposes ---here  I get 0
                              for(var extra in intent.extras) {             
                                      data= intent.extras[extra].value;
                                      Device.sendKeys(data);       
                              }                                 
                          }
                          );
                }
                else
                {
                          Device.beep(1000,200,0);
                }
              }
              WLEvent.on("Key", sendAction);
              
              • 4. Re: How to send data from a thrid android app to Velocity
                Rookie

                Hi,

                 

                did you find any solutions to send data ? Copy and paste method also does not work?

                 

                ntent sendIntent = new Intent();

                            sendIntent.SetClassName("com.wavelink.te", "com.wavelink.te.TerminalEmulationActivity");

                         //   sendIntent.SetComponent(new ComponentName("com.wavelink.te","com.wavelink.te.TerminalEmulationActivity"));

                            sendIntent.AddCategory("android.intent.category.DEFAULT");

                            sendIntent.SetAction(Intent.ActionSend);

                            sendIntent.PutExtra(Intent.ExtraText, "This is my text to send.");

                    sendIntent.SetType("text/plain");

                 

                 

                           

                                StartActivity(sendIntent);

                • 5. Re: How to send data from a thrid android app to Velocity
                  Rookie

                  Hi,

                   

                  Could you give more info?