0

I am trying to make an intent using androidhelper in Qpython OL with the code below:

action = "org.escpos.intent.action.PRINT"
packagename =  "com.loopedlabs.escposprintservice" #  target application
data = data # convert data to PDF byte array format
extras = {
         'DATA_TYPE':'PDF',
        'PDF_DATA' : data # raw PDF data
}
intent = droid.makeIntent( # make an intent
    action = action,
    packagename = packagename,
    extras = extras
)

But I am having the following Error:

org.json.JSONException: Value [2,{"extras":{"DATA_TYPE":"PDF","PDF_DATA":"4"},"categories":null,"action":"org.escpos.intent.action.PRINT","flags":268435456},null] at 0 of type org.json.JSONArray cannot be converted to JSONObject

Additionally, I did not find any working example of android.makeIntent(). Could somebody help, please?

1 Answer 1

1

I think something went wrong in extras. What's your data? Are you sure it can be called in this way?

Here's a working makeIntent example. This works on my phone:

#-*-coding:utf8;-*-
#qpy:2
#qpy:console

from androidhelper import Android
droid = Android()
uri2open = "https://google.com"
intent2start = droid.makeIntent("android.intent.action.VIEW", uri2open, "text/html", None, [u"android.intent.category.BROWSABLE"], None, None, None)
print(droid.startActivityForResultIntent(intent2start.result))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.