setAppId
Associates current application with the given Pushwoosh application code.
This method provides a runtime alternative to defining "com.pushwoosh.appid" metadata in AndroidManifest.xml. The application code can be found in your Pushwoosh Control Panel. Example:
Pushwoosh.getInstance().setAppId("XXXXX-XXXXX");
Parameters
Pushwoosh application code
Associates current application with the given Pushwoosh application code and API base URL.
Use this overload when the app talks to more than one Pushwoosh backend (for example one region per country) and the user can switch between them at runtime. The pair is applied atomically: the SDK never registers the device against the base URL computed from the application code while the explicit URL is still on its way. The URL is used as-is and must be the full API endpoint, including the API version path:
Pushwoosh.getInstance().setAppId("XXXXX-XXXXX", "https://api.example.com/json/1.3/");
- changing the application code unregisters the device from the previous application and re-registers it against the new one; the local inbox is cleared as well;
- changing only the base URL never triggers that cycle: requests are simply re-pointed to the new address (server-migration semantics), exactly like a server-side rotation or the
set_base_urlcommand — the device keeps its registration and its local inbox. This call does not force a re-registration; the device is registered against the new address by the regular registration update on a later app start, no sooner than 10 minutes after the last successful registration; - calling it again with the same pair is a no-op, so it is safe to call on every app start;
- the URL is persisted and survives an app restart; background requests use it too;
- the server may still override it later (base URL rotation in a response, or the
set_base_urlpush command); - if either argument is invalid the whole call is ignored and an error is logged — neither the application code nor the URL is applied;
- a
nullor empty URL means "no explicit URL" rather than an invalid one: the call behaves exactly like setAppId and the URL is derived from the application code. This keeps wrapper bridges (Flutter, React Native) that pass an optional argument straight through from dropping the application code; - to return to the default URL, switch the application code with setAppId or pass the default URL explicitly.
Parameters
Pushwoosh application code
full Pushwoosh API endpoint, e.g. https://api.example.com/json/1.3/, or null/empty to use the URL derived from the application code