Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » API 31 Plugins

Pages: [1]
Author Topic: API 31 Plugins
ExcellentName
Member
Posts: 3
Post API 31 Plugins
on: January 2, 2022 (GMT)

I have an old plugin that I keep getting complaints about API 31.

I did see Torque reverted to API 30, but that’s not a long-term solution as Google will force API 31 at some point.

Torque needs to do a few changes to get API 31 working.

1. Torque needs to see the plugins. Which means adding to the manifest:

<queries>
 <package android:name="org.prowl.torque"/>
 <intent>
 <action android:name="org.prowl.torque.PID_QUERY" />
 </intent>
 <intent>
 <action android:name="org.prowl.torque.ACTIVITY_PLUGIN" />
 </intent>
 </queries>

Another option is the QUERY_ALL_PACKAGES permission
https://support.google.com/googleplay/android-developer/answer/10158779?hl=en

2. Torque needs to change how PIDs are added by plugins. The current system uses a service to send that information, which can be started by the broadcast org.prowl.torque.PID_QUERY

Instead, Torque should use a content resolver which queries the content providers of plugins for PIDs. This could be a button in the external pids menu.
[url=https://developer.android.com/guide/topics/providers/content-providers.
]https://developer.android.com/guide/topics/providers/content-providers.
Doesn’t seem to be quite needed, although content providers will be nicer.

3. All old plugins will have to update to API 31 as they will otherwise be broken. That’s kind of unfortunate.

Torque adding the queries to the manifest seems to fix old ones as well.

piemmm
Administrator
Posts: 6623
Post Re: API 31 Plugins
on: January 2, 2022 (GMT)

Hi!

This was already addressed about a year ago in API26 when the API changes were actually made (and and package manger installed packages methods/intents started returning only the app name)

This also works in API31 and above (this is with a target of 30 or 31+ being targeted by Torque), plugins are still found and is not an issue.

You must make sure your AndroidManifest.xml in your plugin is correctly defined – if it is not, then your plugin will not be seen by torque:


        <receiver
            android:name=".PluginReceiver"
            android:enabled="true"
            android:exported="true"
            android:label="PID Example plugin">
            <intent-filter>
                <action android:name="org.prowl.torque.PID_QUERY" />
            </intent-filter>
            <intent-filter>
                <action android:name="org.prowl.torque.PID_PLUGIN" />
            </intent-filter>
        </receiver>

piemmm
Administrator
Posts: 6623
Post Re: API 31 Plugins
on: January 2, 2022 (GMT)

Hi!

Looking into this now to try to reproduce – You may have found an issue (introduced at release time) – could you send me your manifest xml for the plugin to ian@prowl.org and I’ll see if I can workaround it – if not there may be a small change required

piemmm
Administrator
Posts: 6623
Post Re: API 31 Plugins
on: January 2, 2022 (GMT)

Hi!

Found the issue, fixed the build process and this will be in beta shortly (and then swiftly move to production once I know the release is good). Apologies for the breakage here

Edit: Now in the live production release

ExcellentName
Member
Posts: 3
Post Re: API 31 Plugins
on: January 6, 2022 (GMT)

The below is what I added on the API 31 plugin’s manifest and it seems to be working with the current production version of Torque Pro (which I verified was running API 31).

 
 
<queries>
 <package android:name="org.prowl.torque"/>
 <intent>
 <action android:name="org.prowl.torque.PID_QUERY" />
 </intent>
 <intent>
 <action android:name="org.prowl.torque.ACTIVITY_PLUGIN" />
 </intent>
 </queries>
       
       

I was actually expecting the API 31 change to just completely break querying broadcast receivers. But they do seem to be working with the PID_QUERY added in the Torque’s manifest.

Sadly, this new ‘query’ declaration is just barely documented at all. I’ll update the plugin on the play store (BiScan) and see if any issues pop up in a live version.

On older API plugins. It does actually seem to be working even without the query in the manifest. I am not 100% sure if the queries are needed in plugin apps, but it does seem a best practice. When I was testing earlier adding the queries fixed a lot of issues with a API 31 plugin running on API 30 torque pro.

Pages: [1]
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.019 seconds.

  Follow me on twitter