Receiving Intent from background service on a Zebra Scanner

163 views
Skip to first unread message

[Backroom-Studio]

unread,
Feb 7, 2024, 11:48:36 AMFeb 7
to DroidScript
Hello,

I'm tryin to receive intent data from an android service called DataWedge on our android based Zebra scanners at work and I just can't seem to get it working properly...

should I have it send the intent as a StartActivity, StartService or Broadcast Intent?

On top of that it says I need to add the following lines to the AndroidManifest.xml file (not sure if I can even do that)

<action android:name="android.intent.action.DEFAULT" /> 
<category android:name="android.intent.category.MAIN" /> 

also mentions something about setting up an intent receiver... But I'm unable to find that in the documentation now....

Here is a link to a simple Java application that receives a broadcast intent,  If anyone wants to look it over and help me translate what they are doing over to DroidScript code I will be eternally gratefully.,  Hell, I might even buy you a beer (or a coffee if you don't drink)


Alan Hendry

unread,
Feb 7, 2024, 2:55:53 PMFeb 7
to DroidScript
HI,
Shows how to use build.json (example below)
Shows details of OnData (receive intent)
Then you need to build and install
Regards, ah

{
    "manifest":
    {
        "minSdkVersion": 23,
        "targetSdkVersion": 28,
        "debuggable": false,
        "urlHost": "*",
        "urlScheme": "http,https"
    }
}



Dave

unread,
Feb 9, 2024, 11:46:24 AMFeb 9
to DroidScript
In theory it should be simple to send a Broadcast to DS and you should not have to mess with manifests (as long as your DS app is already running)... you should just be able to do something like this in your main DS script - 

app.SetOnBroadcast(  OnBroadcast, "com.dwbasicintent1.ACTION"  )

function OnBroadcast( json )
{
   alert( json )
   var data = JSON.parse( json )
   console.log( "action: " + data.action )
}

Let us know if this works.

Dave

unread,
Feb 9, 2024, 12:11:00 PMFeb 9
to DroidScript
You might also be able to use the startActivity method in Zebra by targeting this package and activity type - 

package: com.smartphoneremote.androidscriptfree
activity: com.smartphoneremote.ioioscript.NewActivity

The data should appear in the standard OnData() function (see the 'Receive Intent' sample)

Those names would change if you build a stand-alone APK, to this - 

package: com.yourname.yourapp
activity: com.smartphoneremote.androidscriptfree.AndroidScriptFree

[Backroom-Studio]

unread,
Apr 6, 2024, 2:13:43 AMApr 6
to DroidScript
I'm going to move this post over to the Premium Forum... I've also made a FEW PROMISING changes and compiled A fresh APK today... Going to copy the file over and install the new version on a scanner tomorrow morning and see if I get the results I'm hoping for..


Will post a full update on the Premium forum post tomorrow after testing.

[Backroom-Studio]

unread,
Apr 6, 2024, 2:24:11 AMApr 6
to DroidScript
https://groups.google.com/g/droidscriptpremium/c/iJkxJZz6Uko/m/_7pPx3EjAwAJ

On Wednesday, February 7, 2024 at 11:48:36 AM UTC-5 [Backroom-Studio] wrote:
Reply all
Reply to author
Forward
0 new messages