Giter Site home page Giter Site logo

Comments (4)

tmo1 avatar tmo1 commented on June 2, 2024 1

The app configuration has (and I think has always had) a minSdkVersion of 23 (6.0 Marshmallow),

Correct.

Here's an excerpt of an email I wrote on Dec. 14, 2021 in response to a question about the possibility of building SMS I/E for Android 4.3:

The original requirement of API >= 23 was due to the requirement introduced there to do run-time permission requests, and the necessary code to do those checks does not run on API < 23. This should be easy to get around, by simply removing the run-time permission requests (and relying on the manifest permission declarations, as early versions of Android did):

https://developer.android.com/about/versions/marshmallow/android-6.0-changes
https://devtut.github.io/android/runtime-permissions-in-api-23.html

Currently, there's also an API call to getOrCreateThreadId, introduced in API 23 as well:

https://developer.android.com/reference/android/provider/Telephony.Threads

as well as a bunch of other calls to the Telephony provider API, introduced in API 19:

https://developer.android.com/reference/android/provider/Telephony

So my guess is that getting it to work on API < 19 may require significant refactoring. Getting to 19 from 23 may be more manageable, if there's some relatively straightforward way of rewriting the call to getOrCreateThreadId and / or the code around it - see:

https://stackoverflow.com/questions/45070889/getorcreatethreadid-in-api-21

Even if there isn't, that call is only needed for importing MMS messages - exporting SMS and MMS messages, and importing SMS messages, do not require it, so if the MMS import code is simply removed, everything else should work at API 19.

Basically, the app has two function calls that require API level >= 23: requestPermissions and getOrCreateThreadId and thus will (I think) crash the app if invoked on a device with API level < 23.

When you ran the app on Android 4.4.4, I assume that you never hit the requestPermissions call, since the requirement to ask for dangerous permissions at runtime was added in Android 6.0 (API level 23), and you never hit the getOrCreateThreadId call since that's only used on import, not export.

Now that you've gotten me to consider the matter more carefully (thanks!), it seems that lowering minSdkVersion to 19 should be fairly simple - just a matter of testing for API level >= 23 before calling requestPermissions (or perhaps switching to the Activity.Compat version of requestPermissions) and disabling messages import on API level < 23. I'll try this out and update the app accordingly if it works.

from sms-ie.

tmo1 avatar tmo1 commented on June 2, 2024 1

It looks like the Android team has a Java backport of getOrCreateThreadId that would enable import functionality to be provided on earlier API levels. I personally have no need for import functionality on KitKat, but this might be an easy win for compatibility.

Thanks! I don't think I'm going to bother with it, though, unless I can find an official documented version, especially since I doubt that there is a great need for import functionality on KitKat.

from sms-ie.

jakobcornell avatar jakobcornell commented on June 2, 2024

Awesome, thank you!

from sms-ie.

jakobcornell avatar jakobcornell commented on June 2, 2024

It looks like the Android team has a Java backport of getOrCreateThreadId that would enable import functionality to be provided on earlier API levels. I personally have no need for import functionality on KitKat, but this might be an easy win for compatibility.

from sms-ie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.