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

cant get version result in Android #55

Open
kriit24 opened this issue Apr 4, 2024 · 4 comments
Open

cant get version result in Android #55

kriit24 opened this issue Apr 4, 2024 · 4 comments

Comments

@kriit24
Copy link

kriit24 commented Apr 4, 2024

import { checkVersion } from "react-native-check-version";

const version = await checkVersion();
console.log("Got version info:", version);

if (version.needsUpdate) {
   console.log(`App has a ${version.updateType} update pending.`);
}

RESULT:
Got version info: {"bundleId": null, "country": "us", "error": [Error: App with bundle ID "null" not found in Google Play.], "lastChecked": "2024-04-04T03:59:10.402Z", "needsUpdate": false, "notes": "", "platform": "android", "url": null, "version": null}

@cas8398
Copy link

cas8398 commented Apr 5, 2024

you need add manual app id.

import { CheckVersionOptions, checkVersion } from "react-native-check-version";


const options: CheckVersionOptions = {
      bundleId: "com.example.id", // Replace with your bundle ID
    };


const appVersion = await checkVersion(options); // Handle the response
console.log(appVersion);
console.log("App version:", appVersion.version);
console.log("App needs update:", appVersion.needsUpdate);
console.log("Update URL:", appVersion.url);

@kriit24
Copy link
Author

kriit24 commented Apr 6, 2024

hi, now it worked but it shows "needsUpdate" true, but i have the latest version.

{"bundleId": "com.project.cronimetcrm", "lastChecked": "2024-04-06T03:50:45.664Z", "needsUpdate": true, "notes": "", "notice": "Invalid version. Must be a string. Got type \"object\".", "platform": "android", "releasedAt": "2024-04-06T03:50:45.663Z", "updateType": "minor", "url": "https://play.google.com/store/apps/details?id=com.project.cronimetcrm&hl=us", "version": "1.0.1"}

*** EDIT ***
i added currentVersion to option and now its shows correct info
{"bundleId": "com.project.cronimetcrm", "lastChecked": "2024-04-06T03:56:42.409Z", "needsUpdate": false, "notes": "", "platform": "android", "releasedAt": "2024-04-06T03:56:42.409Z", "updateType": null, "url": "https://play.google.com/store/apps/details?id=com.project.cronimetcrm&hl=us", "version": "1.0.1"}

@cas8398
Copy link

cas8398 commented Apr 6, 2024

great, you need re-run yarn android or npm android. for auto check your bundleId and currentVersion.

const appVersion = await checkVersion(); // now you can remove option

@kriit24
Copy link
Author

kriit24 commented Apr 6, 2024

now, the second thing is with IOS.
the error is - Error: App for this bundle ID not found.
this error is not only with "react-native-check-version" package, but also with similar packages.
This is the first time I've received feedback.
And the ios buindleid is different from android.

options:
Object { "bundleId": "com.project.cronimetcrmv2", "country": "et", "currentVersion": "1.0.1", }

result:
Object { "bundleId": "com.project.cronimetcrmv2", "country": "et", "error": [Error: App for this bundle ID not found.], "lastChecked": "2024-04-06T08:28:20.050Z", "needsUpdate": false, "notes": "", "platform": "ios", "url": null, "version": null, }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants