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

Android: does not register device, oneSignalRestClient returns "Invalid device_type format! Expected integer" #557

Closed
ivanlyubimov opened this issue Jun 12, 2018 · 9 comments

Comments

@ivanlyubimov
Copy link

Description:
SDK doest not register device.

New device does not appear in dashboard device list.
Initialisation done specifying onesignal_app_id and onesignal_google_project_number in build.gradle.
Following logcat I noticed that there is request failing to onesignal api:

D/OneSignal: OneSignalRestClient: Making request to: https://onesignal.com/api/v1/players/2d9e5e61-46c4-4080-8a81-d47455ecaa9f/on_session D/OneSignal: OneSignalRestClient: POST SEND JSON: {"app_id":"myonesignalappidhere"} D/OneSignal: OneSignalRestClient: Failed request to: https://onesignal.com/api/v1/players/2d9e5e61-46c4-4080-8a81-d47455ecaa9f/on_session W/OneSignal: OneSignalRestClient: POST RECEIVED JSON: {"errors":["Invalid device_type format! Expected integer"]} W/OneSignal: Failed last request. statusCode: 400 response: {"errors":["Invalid device_type format! Expected integer"]}

Notably, after number of launches throughout an hour it returns 200 and registers new device. Without any code change

Environment

  1. What version of the OneSignal React-Native SDK are you using?
    3.1.4
  2. How did you add the SDK to your project
    npm

Steps to Reproduce Issue:

  1. Install the OneSignal SDK using npm into your project
  2. Initialize the SDK in the android/build.gradle
  3. Launch app, see logcat, check dashboard for new device

Anything else:
In attempt to find a way around the issue, I tried few different sdk versions as well as latest, but ultimately hit #516 or #515 every time

@Nightsd01
Copy link
Contributor

Nightsd01 commented Jun 13, 2018

@ivanlyubimov Did you manually delete the user for this device in our dashboard? This would happen if you deleted a user without uninstalling the app, because the app still has the old player_id saved locally.

In short, I'm pretty sure this happened because you either deleted the player id, or possibly because you have a mixup with different App ID's (perhaps you use one for production and one for development and didn't uninstall the app before switching?)

If not, can you please completely uninstall your app, then install the app, run it for ~30 seconds, and then send us a link to the logcat?

@ivanlyubimov
Copy link
Author

ivanlyubimov commented Jun 13, 2018

@Nightsd01 yes, I have deleted device manually from dashboard. Didn't think it would cause problem.

Anyways, If I uninstall app from device, it still appears on the dashboard. And app returns same error in logs. Here is logfile

@Nightsd01
Copy link
Contributor

@ivanlyubimov Yes, deleting a device from OneSignal will cause a problem when you keep trying to use that same device.

This error means exactly the same thing. I would advise that you don't delete users from the dashboard from now on? Why are you deleting them in the first place? Perhaps there is a better way to accomplish what you are trying to do.

Also, I would recommend looking at this troubleshooting section for that custom tabs issue.

@ivanlyubimov
Copy link
Author

ivanlyubimov commented Jun 13, 2018

@Nightsd01 After all, scenario where dashboard user deletes device is for testing purpose I supposed

I need to make sure that sdk indeed subscribes at the moment when user opens application
What would be right way to do that?

To clarify: after multiple sdk migrations, I want to ensure that thing works.
Devices I have were already subscribed to service, but sdk failed with #516 mentioned above.
Now when we back to 1.3.4, due to nature of our app, we need to know that device is subscribed and user can accept notifications right after launch

@Nightsd01
Copy link
Contributor

We've made many bug fixes since 3.1.4.

In any case, the main issue you are facing is caused by the fact that you are deleting users so I'll be closing this issue, but we'll be happy to help you fix #516 and #515.

When you update back to the latest version of our SDK, please post on either 515 or 516 depending on what issue you run into. Then in that git issue, please post your app/build.gradle, android/build.gradle, and gradle-wrapper.properties.

@ivanlyubimov
Copy link
Author

@Nightsd01 yet you didn't address how could one test subscription correctly. Does it mean deleted device ids can no longer work with onesignal platfrom?

@jkasten2
Copy link
Member

@ivanlyubimov After the on_session error the SDK will automatically create a new player for your app even on the 3.1.4 SDK. We haven't seen any cases where this wasn't handled correct.

For the other issues you linked to we will follow up there

@nishkul
Copy link

nishkul commented May 9, 2019

Above the same issue is have in android also with me and giving same bellow error as i deleted user from dashboard, not app is not uninstall
OneSignalRestClient: POST RECEIVED JSON: {"errors":["not a valid device_type"]}
Failed last request. statusCode: 400
response: null

@hugoh59
Copy link

hugoh59 commented Jun 14, 2019

I'm also unable to register my android devices wether I use a real device or an emulator. No error message tho. I've followed all the setup instructions.

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

5 participants