I'm pretty new to programming in Java and generally programming. Right now I decided to make my own app that is supposed to utilize Google Cloud Messaging. And somehow I succeeded but then I realized I used method
String regid = gcm.register(PROJECT_NUMBER);
that is deprecated and I should now use tokens and InstanceIDs. So I tried rewriting my registration to use it but I encountered a problem with InstanceID.getInstancer(). I carefully followed all steps from documentation https://developers.google.com/instance-id/guides/android-implementation and somehow it still doesn't work.
String authorizedEntity = "79424738XXXX"; String scope = "GCM"; String token = InstanceID.getInstance().getToken(authorizedEntity,scope);
Android Studio tells me that error is:
getInstance() - "getInstance (Context) in InstanceID cannot be applied to 0"
Thanks in advance!