Search code examples
androidsmsbroadcastreceiver

Using method defined in android SDK api


I am trying to use the method getMessagesFromIntent(Intent intent) defined in Android SDK API. You can see its definition from here.

However, even after I import android.provider.Telephony.Sms.Intents which contains the method, I get the method is not defined. This post defines the method from scratch but I am confused why I can't just use the one defined inside the above library. Am I understanding something wrong? Could anyone explain why I cannot use getMessagesFromIntent(Intent intent)?


Solution

  • In the documentation you linked, it mentions the following on the right of the title describing the method:

    Added in API level 19
    

    So to use this method, you must set your build target to be 19 or higher. Even then, only devices that support API 19 or higher will be able to make use of it.