Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startReadSMS seems to be inactive #24

Closed
akki251 opened this issue Feb 21, 2023 · 3 comments
Closed

startReadSMS seems to be inactive #24

akki251 opened this issue Feb 21, 2023 · 3 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@akki251
Copy link

akki251 commented Feb 21, 2023

Describe the bug
Attached is the code snippet, where I tried to run, I have enable the permissions through the Popup, but startReadSms isn't getting called similar to Issue #18 .

import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View, Button } from "react-native";

import {
  checkIfHasSMSPermission,
  requestReadSMSPermission,
  startReadSMS,
} from "@maniac-tech/react-native-expo-read-sms";

export default function App() {
  const successHandler = (status, sms, error) => {
    console.log(status);
  };
  const errorHandler = (status, sms, error) => {
    console.log("error");
  };
  const btnHandler = async () => {
    try {
      const permissionState = await checkIfHasSMSPermission();

      if (permissionState.hasReadSmsPermission)
        await startReadSMS(successHandler, errorHandler);
    } catch (error) {
      console.log("error");
      console.log(error.message);
    }
  };

  return (
    <View style={styles.container}>
      {/* <Text>Open up App.js to start working on your app!</Text> */}
      <Button title="set sms" onPress={btnHandler} />
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});

To Reproduce
Steps to reproduce the behavior:
You can copy and paste above code in the latest expo app

Expected behavior
It should return me the latest sms received

Screenshots
image
Although the function initiates warning but doesn't return the sms as stated.

Additional context
I have enabled all the permissions, Do let me know If I am missing something.

@maniac-tech
Copy link
Owner

Thanks for sharing the detailed information.

Will look into this.

@maniac-tech maniac-tech self-assigned this Feb 21, 2023
@maniac-tech maniac-tech added bug Something isn't working good first issue Good for newcomers WIP This is currently being worked upon labels Feb 21, 2023
@akki251
Copy link
Author

akki251 commented Feb 22, 2023

I recently checked @maniac-tech , It started working fine somehow

@maniac-tech
Copy link
Owner

I recently checked @maniac-tech , It started working fine somehow

Great, considering no issue here, I'm closing this here.

Feel free to reopen this in case you face it again.

@maniac-tech maniac-tech removed the WIP This is currently being worked upon label Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants